我在执行期间遇到问题,我认为连接器的ldap.init参数可能有问题。在执行此组件期间,故障流程会产生错误:
[2016-04-22 18:08:24,089] INFO - LogMediator To: /SampleContextLdapContext, MessageID: urn:uuid:bd9a9e05-84eb-48d9-8cef-6eff06b6f64d, Direction: request, DEUPAU = An error has been gotten, messageFaultError = Error occured in the mediation of the class mediator, messageFaultCode = 0, messageFaultException = , messageFaultDetail = org.apache.synapse.SynapseException: Error occured in the mediation of the class mediator
at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:82)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
at org.apache.synapse.mediators.template.TemplateMediator.mediate(TemplateMediator.java:97)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:129)
at org.apache.synapse.mediators.template.InvokeMediator.mediate(InvokeMediator.java:78)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:81)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:48)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:149)
at org.apache.synapse.rest.Resource.process(Resource.java:297)
at org.apache.synapse.rest.API.process(API.java:378)
at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:97)
at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:65)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:266)
at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:317)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:363)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:142)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(Unknown Source)
at org.wso2.carbon.connector.ldap.Authenticate.connect(Authenticate.java:55)
at org.wso2.carbon.connector.core.AbstractConnector.mediate(AbstractConnector.java:32)
at org.apache.synapse.mediators.ext.ClassMediator.mediate(ClassMediator.java:78)
... 22 more
似乎我错过了一些参数,因为Authenticate.java中发生了错误。查看line 55 in the GitHub,现在查看我的部分XML:
<api context="/SampleContextLdapContext" name="SampleLdapName" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="POST" protocol="http">
<inSequence>
<log description="" separator=",">
<property name="Message Flow" value="LDAP SAMPLE TEST"/>
<property expression="//myvar/text()" name="myVarValue"/>
</log>
<ldap.init>
<providerUrl>ldap://192.168.2.10:389/</providerUrl>
<securityPrincipal>aqlbras\willian</securityPrincipal>
<securityCredentials>SamplePassword</securityCredentials>
</ldap.init>
当我没有配置 providerUrl 时,错误发生在第54行,这意味着name参数对于此标记是正确的,但对于 securityPrincipal 标记是不正确的(您可以在GitHub存储库中看到以确保)。
我错过了什么或者代码中有错误吗?
答案 0 :(得分:0)
我认为问题在于您的securityPrincipal不是LDAP专有名称(DN)。例如,它看起来像uid=willian,ou=people,dc=aqlbras,dc=com
如果您没有设置providerUrl,我会对您收到NullPointerException感到惊讶。这基本上是LDAP服务器的主机名/端口信息。