在wso2套接字上发送消息,获得异常

时间:2015-08-20 06:57:54

标签: java wso2 wso2esb wso2carbon

我正在尝试在wso2框架中通过TCP发送消息。我在日志中收到此异常:

[2015-08-20 12:21:50,098] ERROR - TCPWorker Error while processing TCP request through the Axis2 engine
java.lang.NullPointerException
        at org.wso2.carbon.tenant.dispatcher.MultitenantDispatcher.findService(MultitenantDispatcher.java:47)
        at org.apache.axis2.engine.AbstractDispatcher.invoke(AbstractDispatcher.java:94)
        at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
        at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
        at org.apache.axis2.transport.tcp.TCPWorker.run(TCPWorker.java:68)
        at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)

以下是启动TCP的axis2 conf:

<transportReceiver name="local" class="org.wso2.carbon.core.transports.local.CarbonLocalTransportReceiver"/>

<transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportListener">
                <parameter name="transport.tcp.port">6060</parameter>
</transportReceiver>

wso2.xml

<definitions xmlns="http://ws.apache.org/ns/synapse">

    <sequence name="fault">
        <makefault>
            <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/>
            <reason value="Mediation failed."/>
        </makefault>
        <send/>
    </sequence>


    <proxy xmlns="http://ws.apache.org/ns/synapse"
           name="TCPProxy"
           transports="https,http"
           statistics="disable"
           trace="disable"
           startOnLoad="true">
        <target>
            <inSequence>
                <log level="full"/>
            </inSequence>
            <outSequence>
                <send/>
            </outSequence>
        </target>
        <parameter name="transport.tcp.port">6060</parameter>
        <parameter name="transport.tcp.contentType">application/xml</parameter>
        <description/>
    </proxy>
</definitions>

1 个答案:

答案 0 :(得分:1)

听起来在tcp端口6060上收到消息时,无法在ESB中找到代理服务。

我不习惯在WSO2中使用tcp传输,但我想知道代理定义中的“transports”属性是否应该包含“tcp”而不是“https,http”:

<proxy xmlns="http://ws.apache.org/ns/synapse"
           name="TCPProxy"
           transports="tcp"
           statistics="disable"
           trace="disable"
           startOnLoad="true">
        <target>
            <inSequence>
                <log level="full"/>
            </inSequence>
            <outSequence>
                <send/>
            </outSequence>
        </target>
        <parameter name="transport.tcp.port">6060</parameter>
        <parameter name="transport.tcp.contentType">application/xml</parameter>
        <description/>
    </proxy>