我正在使用 JBoss AS 7 Hornetq。我们的独立 java 应用程序与队列交互并发送消息。我们已经完成了整个环境设置,并且运行得非常顺利。突然,在美好的一天,我们的独立应用程序失败了,但出现以下异常:
Caused by: java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy
详细的异常堆栈跟踪如下
javax.naming.NamingException:无法在 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 ) 在 org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79) 在 org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83) 在 javax.naming.InitialContext。在 com.infosys.lbs.publishing.LocationProcessor.process(LocationProcessor.java:69) 在 com.infosys.lbs 在 com.infosys.lbs.publishing.LocationProcessor.postMessageInQueue(LocationProcessor.java:377) 查找(未知来源)。publishing.main.Publisher.main(Publisher.java:34) 引起:java.io.NotSerializableException: org.hornetq.api.core.client.loadbalance.RoundRobinConnectionLoadBalancingPolicy at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller .java:891)在 org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019) 在 org.jboss.marshalling.doWriteFields(RiverMarshaller.java:1063) 在 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)在 org.jboss 的 org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:998)。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) 引起经过:发生的异常:在对象 org.hornetq.jms.client.HornetQJMSConnectionFactory@ea074d 中的字段 serverLocator 中的字段 loadBalancingPolicy
当应用程序尝试查找连接工厂时发生异常
QueueConnectionFactory qcf = (QueueConnectionFactory)context.lookup("jms/RemoteConnectionFactory");
以下是我们如何解决问题的步骤