Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Class Cast Exception

I have a POJO "GridEntry" and there is a processing unit which listens for the notifications based on this POJO. Whe I deploy the processing unit I am getting following errors:

2009-09-19 01:12:34,678 GSC SEVERE [com.gigaspaces.grid.gsc] - Failed to instant iate notifypu [1]; Caused by: org.jini.rio.core.JSBInstantiationException: java. lang.ClassCastException: com.truedataindia.api.GridEntry cannot be cast to com.t ruedataindia.api.GridEntry at com.truedataindia.api.GridEntryGigaspacesMethodinternalGet0.internalG et(Unknown Source) at com.gigaspaces.internal.reflection.fast.AbstractGetterMethod.get(Abst ractGetterMethod.java:33) at com.gigaspaces.internal.metadata.SpacePropertyInfo.getValue(SpaceProp ertyInfo.java:118) at com.gigaspaces.internal.metadata.PojoIntrospector.getValue(PojoIntros pector.java:287) at com.gigaspaces.internal.metadata.PojoIntrospector.getID(PojoIntrospec tor.java:118) at com.gigaspaces.internal.metadata.PojoIntrospector.generateUID(PojoInt rospector.java:382) at com.gigaspaces.internal.metadata.PojoIntrospector.toTemplatePacket(Po joIntrospector.java:473) at com.gigaspaces.internal.metadata.TypeDesc.toTemplatePacket(TypeDesc.j ava:408) at com.j_spaces.core.client.transport.TypeManager.buildEntryPacket(TypeM anager.java:141) at com.j_spaces.core.client.transport.TypeManager.getEntryPacketFromObje ct(TypeManager.java:568) at com.j_spaces.core.client.transport.TypeManager.getFullTemplatePacketF romObject(TypeManager.java:530) at com.gigaspaces.internal.client.spaceproxy.actions.SnapshotProxyAction .initialize(SnapshotProxyAction.java:23) at com.gigaspaces.internal.client.spaceproxy.actions.AbstractSpaceProxyA ctionManager.snapshot(AbstractSpaceProxyActionManager.java:212) at com.gigaspaces.internal.client.spaceproxy.AbstractSpaceProxy.snapshot (AbstractSpaceProxy.java:268) at org.openspaces.core.DefaultGigaSpace.snapshot(DefaultGigaSpace.java:2 15) at org.openspaces.events.AbstractTemplateEventListenerContainer.initiali ze(AbstractTemplateEventListenerContainer.java:83) at org.openspaces.events.AbstractTransactionalEventListenerContainer.ini tialize(AbstractTransactionalEventListenerContainer.java:95) at org.openspaces.events.notify.AbstractNotifyEventListenerContainer.ini tialize(AbstractNotifyEventListenerContainer.java:554) at org.openspaces.events.AbstractSpaceListeningContainer.afterProperties Set(AbstractSpaceListeningContainer.java:159) at org.openspaces.events.AbstractTemplateEventListenerContainer.afterPro pertiesSet(AbstractTemplateEventListenerContainer.java:75) at org.openspaces.events.notify.SimpleNotifyContainerConfigurer.notifyCo ntainer(SimpleNotifyContainerConfigurer.java:356) at test.Processor.register(Processor.java:34) at test.Processor.<init>(Processor.java:17) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct orAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC onstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:532) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:1 00) at org.springframework.beans.factory.support.SimpleInstantiationStrategy .instantiate(SimpleInstantiationStrategy.java:61) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBean Factory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb ject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr y.getSingleton(DefaultSingletonBeanRegistry.java:222) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe an(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean (AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory. preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finish BeanFactoryInitialization(AbstractApplicationContext.java:728) at org.springframework.context.support.AbstractApplicationContext.refres h(AbstractApplicationContext.java:380) at org.openspaces.pu.container.integrated.IntegratedProcessingUnitContai nerProvider.createContainer(IntegratedProcessingUnitContainerProvider.java:268) at org.openspaces.pu.container.servicegrid.PUServiceBeanImpl.startPU(PUS erviceBeanImpl.java:536) at org.openspaces.pu.container.servicegrid.PUServiceBeanImpl.doStart(PUS erviceBeanImpl.java:170) at org.jini.rio.jsb.ServiceBeanAdapter$1.run(ServiceBeanAdapter.java:292 ) at org.jini.rio.jsb.ServiceBeanAdapter.start(ServiceBeanAdapter.java:305 ) at org.jini.rio.jsb.JSBLoader.create(JSBLoader.java:106) at org.jini.rio.cybernode.ServiceBeanLoader.load(ServiceBeanLoader.java: 278) at org.jini.rio.cybernode.JSBDelegate.startServiceBean(JSBDelegate.java: 457) at org.jini.rio.cybernode.JSBDelegate.load(JSBDelegate.java:316) at org.jini.rio.cybernode.JSBContainer.activate(JSBContainer.java:195) at org.jini.rio.cybernode.CybernodeImpl.instantiate(CybernodeImpl.java:1 034) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at com.gigaspaces.lrmi.LRMIRuntime.invoked(LRMIRuntime.java:360) at com.gigaspaces.lrmi.nio.Pivot.consumeAndHandleRequest(Pivot.java:402) at com.gigaspaces.lrmi.nio.Pivot.handleRequest(Pivot.java:490) at com.gigaspaces.lrmi.nio.Pivot$ChannelEntryTask.run(Pivot.java:153) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47 1) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. java:1110) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:603) at java.lang.Thread.run(Thread.java:636) h4. Attachments

[GridProcessor.java|/upfiles/13759707474090702.txt]

[GridEntry.java|/upfiles/13759707479389602.txt]

{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=3245]{quote}

asked 2009-09-18 14:48:28 -0500

abhilash428 gravatar image

updated 2013-08-08 09:52:00 -0500

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

Getting "ClassCastException: com.truedataindia.api.GridEntry cannot be cast to com.truedataindia.api.GridEntry" means you have a classloading issue. There is a good chance your PU is constructed incorrectly. How's your processing unit jar looks like and how do you deploy it? How the space is deployed? Shay

answered 2009-09-18 15:53:12 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

Now I am getting class cast exception in Jetty Web app. I am creating space inside the init() method of servlet as

gigaSpace = new GigaSpaceConfigurer(new UrlSpaceConfigurer( "/./nsefeedspace")).gigaSpace();

I placing the api library which conatins "GridEntry" class inside the WEB-INF/lib of the jety webapp.

Exception is :

Problem accessing /jettycomet/feed. Reason: com.gigaspaces.internal.metadata.SpaceMetadataException: Failed to get prop erty value.; nested exception is com.gigaspaces.internal.metadata.converter.Con versionException: com.gigaspaces.internal.metadata.SpaceMetadataException: Fail ed to get property value.

Caused by: java.lang.ClassCastException: com.truedataindia.api.GridEntry cannot be cast to com.truedataindia.api.GridEntry at com.truedataindia.api.GridEntryGigaspacesMethodinternalGet0.internal Get(Unknown Source)

Any help will be useful. Please letme know where should I place the comn api libraries inside the web app.

Thanks , Abhilas

abhilash428 gravatar imageabhilash428 ( 2009-09-19 04:04:29 -0500 )edit

Now I am getting class cast exception in Jetty Web app. I am creating space inside the init() method of servlet as

gigaSpace = new GigaSpaceConfigurer(new UrlSpaceConfigurer( "/./nsefeedspace")).gigaSpace();

I placing the api library which conatins "GridEntry" class inside the WEB-INF/lib of the jety webapp.

Exception is :

Problem accessing /jettycomet/feed. Reason: com.gigaspaces.internal.metadata.SpaceMetadataException: Failed to get prop erty value.; nested exception is com.gigaspaces.internal.metadata.converter.Con versionException: com.gigaspaces.internal.metadata.SpaceMetadataException: Fail ed to get property value.

Caused by: java.lang.ClassCastException: com.truedataindia.api.GridEntry cannot be cast to com.truedataindia.api.GridEntry at com.truedataindia.api.GridEntryGigaspacesMethodinternalGet0.internal Get(Unknown Source)

Any help will be useful. Please letme know where should I place the common api libraries inside the web app.

Thanks , Abhilas

abhilash428 gravatar imageabhilash428 ( 2009-09-19 04:04:41 -0500 )edit

You are using 7.0 GA right?
You should have your jars placed ONLY under your pu directory\lib

Remove it from any other location, lib\ext shared-lib and so on.

eitany gravatar imageeitany ( 2009-09-19 04:20:41 -0500 )edit
0

I don't see any issues in running the code. working perfect for me.

Are you sure you are using the same class for the feeder and processor? How are you deploying your PU? Where do you place your classes?

Thanks Venkat

answered 2009-09-18 15:00:14 -0500

venkatg gravatar image
edit flag offensive delete link more

Comments

Venkat,

I created a jar and place the jar inside the lib folder of processing unit. This issue is caused by frequent deploying and undeploying of PU. When I restarted GSM and GSC, this issue has gone away. But it is a concern.

Another issue is that the notifications doesn't happen everytime. It happens sometimes or intermittently. what is wrong here?

abhilash428 gravatar imageabhilash428 ( 2009-09-18 15:34:22 -0500 )edit

Again I restarted the GSM and GSC, the notifications start working... I think frequent deployment and undeploying is causing problems.

Can anybody tell me a stable version of Gigaspaces XAP?

abhilash428 gravatar imageabhilash428 ( 2009-09-18 15:39:41 -0500 )edit

There is nothing wrong with GigaSpaces.
If you undeploy the space you should restart the client.
Notify registration will not self-heal itself in case the space was restarted. the client need to re-register.
Shay

shay hassidim gravatar imageshay hassidim ( 2009-09-18 15:50:04 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2009-09-18 14:48:28 -0500

Seen: 98 times

Last updated: Sep 18 '09