我正在尝试使用JGroups组播包含许多ResultSet的Serializable对象。由于遵循以下if语句,该对象似乎已收到:
if(msg.getObject() instanceof State)
但是,当我尝试在此对象包含的ResultSet上运行操作时,我在此行获得NullPointer异常:
while(rs.next()) {
这是堆栈跟踪:
Dec 10, 2013 3:08:41 PM org.jgroups.logging.JDKLogImpl error
SEVERE: JGRP000019: failed passing message to receiver: %s
java.lang.NullPointerException
at AuctionImpl.receiveState(AuctionImpl.java:413)
at AuctionImpl.receivePrivateMessage(AuctionImpl.java:335)
at AuctionImpl.access$100(AuctionImpl.java:9)
at AuctionImpl$1.receive(AuctionImpl.java:49)
at org.jgroups.JChannel.up(JChannel.java:738)
at org.jgroups.stack.ProtocolStack.up(ProtocolStack.java:1019)
at org.jgroups.stack.Protocol.up(Protocol.java:409)
at org.jgroups.protocols.FRAG2.up(FRAG2.java:182)
at org.jgroups.protocols.FlowControl.up(FlowControl.java:434)
at org.jgroups.stack.Protocol.up(Protocol.java:409)
at org.jgroups.protocols.pbcast.STABLE.up(STABLE.java:294)
at org.jgroups.protocols.UNICAST3.removeAndDeliver(UNICAST3.java:791)
at org.jgroups.protocols.UNICAST3.handleDataReceived(UNICAST3.java:703)
at org.jgroups.protocols.UNICAST3.up(UNICAST3.java:381)
at org.jgroups.protocols.pbcast.NAKACK2.up(NAKACK2.java:600)
at org.jgroups.protocols.BARRIER.up(BARRIER.java:103)
at org.jgroups.protocols.VERIFY_SUSPECT.up(VERIFY_SUSPECT.java:147)
at org.jgroups.protocols.FD.up(FD.java:255)
at org.jgroups.protocols.FD_SOCK.up(FD_SOCK.java:301)
at org.jgroups.protocols.MERGE2.up(MERGE2.java:209)
at org.jgroups.protocols.Discovery.up(Discovery.java:379)
at org.jgroups.protocols.TP.passMessageUp(TP.java:1399)
at org.jgroups.protocols.TP$MyHandler.run(TP.java:1585)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
有人可以让我知道我可能做错了什么来得到这个错误吗?
答案 0 :(得分:0)
请先使用Util.objectFromByteBuffer(msg.getBuffer())反序列化您的对象,然后再执行任何操作。