1
votes

I'm experimenting with different transports supported by WSO2 ESB. I want to enable TCP Transport for WSO2 ESB. I've downloaded the axis2-transport-tcp-1.0.0.jar and placed it into ESB_HOME/repository/components/lib. I managed to enable Transport Sender by adding

<transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>

to axis2.xml configuration file. In order to enable Transport Receiver I've added a similar line

<transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPServer"/>

However this fails to initialize the Transport Receiver when I restart WSO2 ESB. Instead I get an 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

I've tried supplying port number parameter in axis2.xml but nothing changed.

I've tried to trace the Error. It seems that class object can not be instantiated due to absence of no-parameter constructor. But I've run the following example without any error by using the same jar files:

String className = "org.apache.axis2.transport.tcp.TCPServer";
Class receiverClass;

receiverClass = Loader.loadClass(className);

TransportListener receiver = (TransportListener) receiverClass.newInstance();

I guess it is an integration problem but I could not come up with any solution.

1

1 Answers

2
votes

To enable TCP transport you do not have to add the "axis2-transport-tcp-1.0.0.jar" its nessasary libraries are shipped with WSO2 ESB.

All you have to do is go to axis2.xml available in

ESB_HOME/repository/conf/axis2/axis2.xml

and add following blocks for Transport sender and Transport Reciver here you can add the tcp port by adding

<parameter name="transport.tcp.port">6060</parameter>

As shown below. For transport receiver

<!-- Enable TCP message -->  
<transportReceiver name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportListener">
    <parameter name="transport.tcp.port">6060</parameter>
</transportReceiver>

To add Transport Sender

<transportSender name="tcp" class="org.apache.axis2.transport.tcp.TCPTransportSender"/>

Thank You, Dharshana.