2017-11-08 8 views
1

Apache igniteにリモートリスナーを実装しようとしていますが、何らかの理由で登録に失敗したようですが、次のコードを使用してください。Ignite event listener registration error

IgniteMessaging message = ignite.message(ignite.cluster()); 
message.remoteListen("topic1", new IgniteBiPredicate<UUID, String>() { 

    @Override 
    public boolean apply(UUID e1, String e2) { 
     System.out.println("message received" + e2); 
     return true; 
    } 
    }); 

ただし、登録時に次のエラーが発生します。このエラーの原因として何ができるか

Exception in thread "main" class org.apache.ignite.spi.IgniteSpiException: Failed to marshal custom event: StartRoutineDiscoveryMessage [startReqData=StartRequestData [prjPred=AlwaysTruePredicate [], clsName=null, depInfo=null, hnd=GridMessageListenHandler [[email protected], clsName=null, depInfo=null, depEnabled=false], bufSize=1, interval=0, autoUnsubscribe=false], keepBinary=false, routineId=13f09f06-4ebe-4cc8-9671-54162472df15] 
 
\t at org.apache.ignite.spi.discovery.tcp.ServerImpl.sendCustomEvent(ServerImpl.java:773) 
 
\t at org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi.sendCustomEvent(TcpDiscoverySpi.java:453) 
 
\t at org.apache.ignite.internal.managers.discovery.GridDiscoveryManager.sendCustomEvent(GridDiscoveryManager.java:2090) 
 
\t at org.apache.ignite.internal.processors.continuous.GridContinuousProcessor.startRoutine(GridContinuousProcessor.java:748) 
 
\t at org.apache.ignite.internal.IgniteMessagingImpl.remoteListen(IgniteMessagingImpl.java:212) 
 
\t at independent.messaging.Receiver.listenForMessages(Receiver.java:71) 
 
\t at independent.messaging.Receiver.main(Receiver.java:55) 
 
Caused by: class org.apache.ignite.IgniteCheckedException: Failed to serialize object: StartRoutineDiscoveryMessage [startReqData=StartRequestData [prjPred=AlwaysTruePredicate [], clsName=null, depInfo=null, hnd=GridMessageListenHandler [[email protected], clsName=null, depInfo=null, depEnabled=false], bufSize=1, interval=0, autoUnsubscribe=false], keepBinary=false, routineId=13f09f06-4ebe-4cc8-9671-54162472df15] 
 
\t at org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:85) 
 
\t at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.marshal(AbstractNodeNameAwareMarshaller.java:70) 
 
\t at org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:99) 
 
\t at org.apache.ignite.marshaller.AbstractNodeNameAwareMarshaller.marshal(AbstractNodeNameAwareMarshaller.java:58) 
 
\t at org.apache.ignite.internal.util.IgniteUtils.marshal(IgniteUtils.java:9815) 
 
\t at org.apache.ignite.spi.discovery.tcp.ServerImpl.sendCustomEvent(ServerImpl.java:769) 
 
\t ... 6 more 
 
Caused by: java.io.NotSerializableException: independent.messaging.Receiver 
 
\t at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184) 
 
\t at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) 
 
\t at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) 
 
\t at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) 
 
\t at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) 
 
\t at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) 
 
\t at org.apache.ignite.internal.GridMessageListenHandler.writeExternal(GridMessageListenHandler.java:244) 
 
\t at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459) 
 
\t at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1430) 
 
\t at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) 
 
\t at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) 
 
\t at org.apache.ignite.internal.processors.continuous.StartRequestData.writeExternal(StartRequestData.java:241) 
 
\t at java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1459) 
 
\t at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1430) 
 
\t at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) 
 
\t at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) 
 
\t at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) 
 
\t at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) 
 
\t at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) 
 
\t at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548) 
 
\t at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509) 
 
\t at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432) 
 
\t at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178) 
 
\t at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348) 
 
\t at org.apache.ignite.marshaller.jdk.JdkMarshaller.marshal0(JdkMarshaller.java:80) 
 
\t ... 11 more

答えて

2

あなたのIgniteBiPredicateはシリアル化され、他のノードに送信されるため、このクラスは匿名であるため、外部クラスもシリアル化されます。

この実装で述語用のprivate static classを作成し、それをremoteListenメソッドの引数として作成することをお勧めします

関連する問題