我正在试验 WSO2 ESB 支持的不同传输。我想为 WSO2 ESB 启用 TCP 传输。我已经下载axis2-transport-tcp-1.0.0.jar
并放入ESB_HOME/repository/components/lib
. 我设法通过添加启用传输发件人
<transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>
到axis2.xml
配置文件。为了启用传输接收器,我添加了类似的行
<transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer"/>
但是,当我重新启动 WSO2 ESB 时,这无法初始化传输接收器。相反,我得到一个InstantiationError
:
org.apache.axis2.AxisFault: Exception occured while loading the Axis configuration from /usr/local/wso2esb/repository/conf/axis2/axis2.xml
at org.wso2.carbon.core.CarbonAxisConfigurator.getAxisConfiguration(CarbonAxisConfigurator.java:190)
at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:64)
at org.wso2.carbon.core.CarbonConfigurationContextFactory.createNewConfigurationContext(CarbonConfigurationContextFactory.java:65)
at org.wso2.carbon.core.init.CarbonServerManager.initializeCarbon(CarbonServerManager.java:398)
at org.wso2.carbon.core.init.CarbonServerManager.removePendingItem(CarbonServerManager.java:290)
at org.wso2.carbon.core.init.PreAxis2ConfigItemListener.bundleChanged(PreAxis2ConfigItemListener.java:118)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: org.apache.axis2.deployment.DeploymentException: org.apache.axis2.transport.tcp.TCPServer
at org.apache.axis2.deployment.AxisConfigBuilder.processTransportReceivers(AxisConfigBuilder.java:643)
at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:130)
at org.wso2.carbon.core.CarbonAxisConfigurator.populateAxisConfiguration(CarbonAxisConfigurator.java:308)
at org.wso2.carbon.core.CarbonAxisConfigurator.getAxisConfiguration(CarbonAxisConfigurator.java:188)
... 8 more
Caused by: java.lang.InstantiationException: org.apache.axis2.transport.tcp.TCPServer
at java.lang.Class.newInstance0(Class.java:340)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.axis2.deployment.AxisConfigBuilder.processTransportReceivers(AxisConfigBuilder.java:627)
... 11 more
我试过提供端口号参数,axis2.xml
但没有任何改变。
我试图追踪错误。由于没有无参数构造函数,似乎无法实例化类对象。但是我使用相同的 jar 文件运行了以下示例,没有任何错误:
String className = "org.apache.axis2.transport.tcp.TCPServer";
Class receiverClass;
receiverClass = Loader.loadClass(className);
TransportListener receiver = (TransportListener) receiverClass.newInstance();
我想这是一个集成问题,但我想不出任何解决方案。