6 Replies Latest reply on Aug 1, 2013 1:28 AM by Pavan Kulkarni

    JBoss AS7 - RemoteConenctionFactory lookup fails with RoundRobinConnectionLoadBalancingPolicy NotSerializableException

    Pavan Kulkarni Newbie

      Issue

      I'm using JBoss AS 7 Hornetq. Our standalone java application interacts with a queue and sends messages. We had the entire environment setup and it was working pretty smoothly. Suddenly, one fine day, our standalone application failed with the below exception:

      Caused by: java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy 

      Detailed exception stack trace is below

      javax.naming.NamingException: Failed to lookup [Root exception is java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy] at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36) at org.jboss.naming.remote.protocol.v1.Protocol$1.execute(Protocol.java:104) at org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1.lookup(RemoteNamingStoreV1.java:79) at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79) at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83) at javax.naming.InitialContext.lookup(Unknown Source) at com.infosys.lbs.publishing.LocationProcessor.postMessageInQueue(LocationProcessor.java:377) at com.infosys.lbs.publishing.LocationProcessor.process(LocationProcessor.java:69) at com.infosys.lbs.publishing.main.Publisher.main(Publisher.java:34) Caused by: java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:891) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885) at org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1063) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019) at org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998) at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:885) at org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:62) at org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:119) at org.jboss.naming.remote.protocol.v1.Protocol$1$2.write(Protocol.java:138) at org.jboss.naming.remote.protocol.v1.WriteUtil.write(WriteUtil.java:61) at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:128) at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73) 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) Caused by: an exception which occurred: in field loadBalancingPolicy in field serverLocator in object org.hornetq.jms.client.HornetQJMSConnectionFactory@ea074d

      Exception was happening when the app was trying to lookup the connection factory

      QueueConnectionFactory qcf = (QueueConnectionFactory)context.lookup("jms/RemoteConnectionFactory"); 

       

      Solution that worked one-time

      We tried the below steps and the issue got resolved:

      There was almost zero help for resolving this issue. A web search on this exception returned next to nothing. However, this particular thread on JBoss AS Dev site spinned a thought in my head:RemoteConnectionFactory is not found when looking up in a remote client

      The scenario mentioned in this thread was not same as ours. (In our app this is the first and the only lookup happening.) This thread got me thinking towards a possible connection factory initialization issue. While there is nothing I could do to debug or find the issue around it, I thought that if I could reinitialize it, that would help.

      So I tried lookup with java:jboss/exported/jms/RemoteConnectionFactory As expected it failed with a NamingException. Hoping that this naming syntax (using java:/) would have resulted in a reinitialization, I tried lookup again with jms/RemoteConnectionFactory. And bingo!!! it worked!

       

      Issue reappearing again

      However, the issue has now started to reappear again, and this time the above steps are not working! Please help!