Axis2 clustering with tomcat

I was recently working with the creating axis2 cluster by using tomcat. Instead of running axis as two different webapps in one tomcat instance, I used two different tomcat instances to create the cluster. But i faced a problem which is already mentioned in here.

java.lang.NullPointerException
at org.apache.axis2.clustering.state.DefaultStateManager.updateContexts(DefaultStateManager.java:81)
at org.apache.axis2.clustering.state.Replicator.replicate(Replicator.java:102)
at org.apache.axis2.receivers.AbstractMessageReceiver.replicateState(AbstractMessageReceiver.java:69)
at org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:73)
at org.apache.axis2.receivers.AbstractMessageReceiver$AsyncMessageReceiverWorker.run(AbstractMessageReceiver.java:301)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

I digged in to see the root cause for this and found that the ClusteringAgent (TribesClusteringAgent) was never initialized and this was causing the NPE in DefaultStateManager. This was because, by default, the parameter “AvoidInitiation” is set as “true” under the clustering section in axis2.xml. So when running axis2 in tomcat, this skips the initiation of the cluster when the ConfigurationContext is being build. This parameter is set to true if initialization is explicitly done by some other party other than axis2 server it self. This issue can be overcome by setting the parameter as “false“.  Then the clustering works as expected.

This post explains more about axis2 clustering on tomcat in detail.

Advertisements

About kishanthan

I’m currently working as a Software Engineer at WSO2, an open source software company. I hold an Engineering degree, majoring in Computer Science & Engineering field, from University of Moratuwa, Sri Lanka.
This entry was posted in Axis2, How to, Java, Tomcat and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s