在 wso2 套接字上发送消息,出现异常

Sending message on wso2 socket, getting exception

我正在尝试在 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.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>

在 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>