在gridgain

时间:2015-09-28 09:31:49

标签: events gridgain ignite

我配置为使用remoteListen方法在gridgain中侦听发现事件但是当我调用future.get()时,我得到以下异常

这是异常堆栈跟踪 lass org.gridgain.grid.GridException:无法序列化对象:StartRequestData [prjPred = null,clsName = null,depInfo = null,hnd = gr.gridgain.grid.kernal.GridEventConsumeHandler @ 7f977fba,bufSize = 1,  interval = 0,autoUnsubscribe = true] 有关更多信息,请参阅     疑难解答:http://bit.ly/GridGain-Troubleshooting     文档中心:http://bit.ly/GridGain-Documentation

    at org.gridgain.grid.marshaller.optimized.GridOptimizedMarshaller.marshal(GridOptimizedMarshaller.java:316)
    at org.gridgain.grid.kernal.processors.continuous.GridContinuousProcessor.sendWithRetries(GridContinuousProcessor.java:1043)
    at org.gridgain.grid.kernal.processors.continuous.GridContinuousProcessor.startRoutine(GridContinuousProcessor.java:501)
    at org.gridgain.grid.kernal.GridEventsImpl.remoteListen(GridEventsImpl.java:101)
    at org.gridgain.grid.kernal.GridEventsImpl.remoteListen(GridEventsImpl.java:88)
    at com.cmc.facts.startup.GridConfig.remoteListen(GridConfig.java:174)
    at com.cmc.facts.startup.GridConfig.afterPropertiesSet(GridConfig.java:124)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4210)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4709)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:583)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:943)
    at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:778)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:504)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:822)Sep 28, 2015 2:10:43 PM org.gridgain.grid.logger.java.GridJavaLogger info

信息:在ASYNC模式下完成预加载[cache = PIDCache,time = 250 ms]

    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
    at org.apache.catalina.core.StandardService.start(StandardService.java:525)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

引起:java.io.NotSerializableException:必须实现java.io.Serializable或将GridOptimizedMarshaller.setRequireSerializable()设置为false(请注意,如果对象不是Se,性能可能会降低 rializable):com.cmc.facts.startup.GridConfig         在org.gridgain.grid.marshaller.optimized.GridOptimizedClassDescriptor.write(GridOptimizedClassDescriptor.java:816)         在org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeObject0(GridOptimizedObjectOutputStream.java:197)         在org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeFields(GridOptimizedObjectOutputStream.java:489)         在org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeSerializable(GridOptimizedObjectOutputStream.java:301)         在org.gridgain.grid.marshaller.optimized.GridOptimizedClassDescriptor.write(GridOptimizedClassDescriptor.java:820)         在org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeObject0(GridOptimizedObjectOutputStream.java:197)         at org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeObjectOverride(GridOptimizedObjectOutputStream.java:128)         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)         在org.gridgain.grid.kernal.GridEventConsumeHandler.writeExternal(GridEventConsumeHandler.java:301)         在org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeExternalizable(GridOptimizedObjectOutputStream.java:269)         在org.gridgain.grid.marshaller.optimized.GridOptimizedClassDescriptor.write(GridOptimizedClassDescriptor.java:810)         在org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeObject0(GridOptimizedObjectOutputStream.java:197)         at org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeObjectOverride(GridOptimizedObjectOutputStream.java:128)         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)         在org.gridgain.grid.kernal.processors.continuous.GridContinuousProcessor $ StartRequestData.writeExternal(GridContinuousProcessor.java:1371)         在org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeExternalizable(GridOptimizedObjectOutputStream.java:269)         在org.gridgain.grid.marshaller.optimized.GridOptimizedClassDescriptor.write(GridOptimizedClassDescriptor.java:810)         在org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeObject0(GridOptimizedObjectOutputStream.java:197)         at org.gridgain.grid.marshaller.optimized.GridOptimizedObjectOutputStream.writeObjectOverride(GridOptimizedObjectOutputStream.java:128)         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)         在org.gridgain.grid.marshaller.optimized.GridOptimizedMarshaller.marshal(GridOptimizedMarshaller.java:311)         ... 44更多

1 个答案:

答案 0 :(得分:0)

您很可能将您的侦听器声明为匿名类。 Java中的匿名类具有父类的链接,因此该父类的实例也是序列化的。如果是这种情况,我建议将监听器转换为内部静态类,并使用Serializable接口标记它。这样,您可以更好地控制应用程序中序列化的内容。