非常に具体的な質問があり、本当にあちこちで答えを検索しました...これが状況です:カスタム集計戦略を備えたScatter-Gatherコンポーネントがあります。
http://clip2net.com/s/j66jK8 - サブフローのイメージ
このプロセスのセマンティックはかなり単純です。要求には基本認証ヘッダーが付属しており、上の道では空の Java プロセッサのみが呼び出され、元のペイロードが返されます。下の道では、LDAP を介してユーザーを認証し、この認証プロセスのブール結果が返されます。カスタム アグリゲーション クラスは結果をチェックし、認証が OK の場合は、道路 #1 からの元のペイロードを返します。OK でない場合は、例外をスローします。ここで問題はありません。動作します。
少しトリッキーなことがあります。ユーザーが間違った認証データを渡した場合、ldap:bind モジュールで例外が発生します。ドキュメントの例外によると、Scatter-Gather に伝播されるため、これを使用してキャッチしようとしています。
@Override
public MuleEvent aggregate(AggregationContext context) throws MuleException {
for (MuleEvent event: context.collectEventsWithExceptions()) {
event.getMessage().getExceptionPayload().getException().printStackTrace();
throw new RuntimeException(event.getMessage().getExceptionPayload().getException());
}
MuleEvent result = DefaultMuleEvent.copy(context.getEvents().get(0));
if (!(Boolean) context.getEvents().get(1).getMessage().getPayload()) {
throw new SecurityException();
}
return result;
}
しかし!javax.naming.AuthenticationException
その結果、ldap:bind コンポーネントによって発生し、自動的にログに出力されたスタックトレースにない例外が表示されます (以下を参照)。
それで、私の質問は次のとおりです。カスタム集計クラスからこの javax.naming.AuthenticationException 例外に到達して再スローするにはどうすればよいですか?
すべてのアイデアと助けに感謝します。前もって感謝します。
WARN 2014-10-15 20:51:18,552 [[minkult].ScatterGatherWorkManager.02] org.mule.module.ldap.api.jndi.LDAPJNDIConnection: Bind failed.
ERROR 2014-10-15 20:51:18,559 [[minkult].ScatterGatherWorkManager.02] org.mule.retry.notifiers.ConnectNotifier: Failed to connect/reconnect: Work Descriptor. Root Exception was: javax.naming.AuthenticationException: [LDAP: error code 49 - INVALID_CREDENTIALS: Bind failed: Attempt to lookup non-existant entry: cn=sim,ou=people,dc=example,dc=com]; resolved object com.sun.jndi.ldap.LdapCtx@5de37d66. Type: class javax.naming.AuthenticationException
COUNT: 1
org.mule.api.transport.DispatchException: route number 1 failed to be executed. Failed to route event via endpoint: InterceptingChainLifecycleWrapper 'wrapper for processor chain 'null''
[
ScriptComponent{CheckAuth.component.553657235},
org.mule.module.ldap.processors.BindMessageProcessor@647af13d,
org.mule.module.ldap.processors.SearchMessageProcessor@2aac6fa7,
InvokerMessageProcessor [name=ldapUtils, object=com.at.mkrf.aggregate.LDAPUtils@5714c7da, methodName=findGroupByName, argExpressions=[#[payload], #[systemName]], argTypes=[Ljava.lang.Class;@5af349a6]
]. Message payload is of type: NullPayload