Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Classloader issues with third party bundles and RMI
Classloader issues with third party bundles and RMI [message #636177] Fri, 29 October 2010 14:33 Go to next message
Dan Carter is currently offline Dan CarterFriend
Messages: 7
Registered: October 2010
Junior Member
Hello,

I am having issues with a service that uses ehcache for a distributed replicated cache ( over RMI ).

The data service bundle imports domain objects from the data model bundle, and imports the ehcache bundle.

The service reads and writes domain objects to/from the database through the ehcache layer.

All works fine if there is only one node.

But with more than one node ehcache will replicate the domain objects to the other nodes using RMI.

On the other nodes the replication fails with class not found for the domain objects.

How is this sort of arrangement normally handled in the OSGi world? I don't want to make ehcache depend on my domain models, and i don't want to send the domain classes themselves over RMI when they are available locally.

Regards,
Dan.


[2010-10-29 13:28:23.385] Replication Thread ERROR System.err Caused by: java.lang.ClassNotFoundException: com.hsbc.gbm.tmcc.charge.domain.Mar
ket in KernelBundleClassLoader: [bundle=com.springsource.net.sf.ehcache_1.6.2] (no security manager: RMI class loader disabled)
[2010-10-29 13:28:23.385] Replication Thread ERROR System.err at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:37 5)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:16 5)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.ja va:620)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java :247)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputS tream.java:197)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream .java:1575)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.ja va:1496)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStre am.java:1732)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject0(ObjectInputStream.java :1329)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject(ObjectInputStream.java: 351)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.util.ArrayList.readObject(ArrayList.java:593)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at sun.reflect.GeneratedMethodAccessor439.invoke(Unknown Source)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
.java:25)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.lang.reflect.Method.invoke(Method.java:597)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass .java:974)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.readSerialData(ObjectInputStream.j ava:1849)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStre am.java:1753)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject0(ObjectInputStream.java :1329)
[2010-10-29 13:28:23.386] Replication Thread ERROR System.err at java.io.ObjectInputStream.defaultReadFields(ObjectInputStrea m.java:1947)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectInputStream.readSerialData(ObjectInputStream.j ava:1871)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStre am.java:1753)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject0(ObjectInputStream.java :1329)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject(ObjectInputStream.java: 351)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at net.sf.ehcache.distribution.EventMessage.readObject(EventMes sage.java:139)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at sun.reflect.GeneratedMethodAccessor438.invoke(Unknown Source)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
.java:25)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.lang.reflect.Method.invoke(Method.java:597)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass .java:974)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectInputStream.readSerialData(ObjectInputStream.j ava:1849)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStre am.java:1753)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject0(ObjectInputStream.java :1329)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject(ObjectInputStream.java: 351)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.util.ArrayList.readObject(ArrayList.java:593)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at sun.reflect.GeneratedMethodAccessor439.invoke(Unknown Source)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl
.java:25)
[2010-10-29 13:28:23.387] Replication Thread ERROR System.err at java.lang.reflect.Method.invoke(Method.java:597)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass .java:974)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at java.io.ObjectInputStream.readSerialData(ObjectInputStream.j ava:1849)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStre am.java:1753)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject0(ObjectInputStream.java :1329)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at java.io.ObjectInputStream.readObject(ObjectInputStream.java: 351)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306 )
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.ja va:290)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err ... 9 more
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err Caused by: java.lang.ClassNotFoundException: com.hsbc.gbm.tmcc.charge.domain.Mar
ket
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at org.eclipse.osgi.internal.loader.BundleLoader.findClassInter nal(BundleLoader
.java:494)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund leLoader.java:41
0)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund leLoader.java:39
Cool
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultCl
assLoader.java:105)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at com.springsource.kernel.userregion.internal.equinox.KernelBu ndleClassLoader.
loadClass(KernelBundleClassLoader.java:145)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at java.lang.Class.forName0(Native Method)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at java.lang.Class.forName(Class.java:247)
[2010-10-29 13:28:23.388] Replication Thread ERROR System.err at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:35 9)
[2010-10-29 13:28:23.389] Replication Thread ERROR System.err ... 51 more

Re: Classloader issues with third party bundles and RMI [message #636182 is a reply to message #636177] Fri, 29 October 2010 14:51 Go to previous messageGo to next message
Dan Carter is currently offline Dan CarterFriend
Messages: 7
Registered: October 2010
Junior Member
PS. I have been looking at the import-scope:=application function commonly used with hibernate. But the senario there seems to be the opposite use-case to RMI.

i.e. it would allow my data-service to export the ehcache classes to the rest of the application.
But in the RMI case i need ehcache to import the domain model classes.

Hmm... perhaps if the data-service imports the data-model with import-scope:=application? Seems a bit of overkill to import the data-model into all bundles just for ehcache to have access to them.
Re: Classloader issues with third party bundles and RMI [message #636298 is a reply to message #636182] Sat, 30 October 2010 14:24 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry SklyutFriend
Messages: 279
Registered: January 2010
Senior Member
How do you deploy our application? Is it in a par/ scoped plan? Only in scoped deployment TCCL will have visibility into all of your application classes. In unscioped deployment you will see errors like this. Each bundle gets it's own classloder based on manifest headers.

You can also try resetting TCCL to the client before calling into service that uses ehcache.

Hope this makes sense.
Re: Classloader issues with third party bundles and RMI [message #636722 is a reply to message #636298] Tue, 02 November 2010 15:00 Go to previous message
Dan Carter is currently offline Dan CarterFriend
Messages: 7
Registered: October 2010
Junior Member
It was an unscoped plan ( as other apps in the same server instance need to be able to call it ) dropped into the pickup directory, with the application and 3rd party bundles copied to repository/usr

I could make it a scoped plan, and just expose as global the bundles which the other apps need to access.

I've made it a scoped plan as a test (with no bundles set to global for now), but still see the exact same error.
Previous Topic:Sudden failure of dependency resolution
Next Topic:Bundle deployment via Eclipse
Goto Forum:
  


Current Time: Sat Apr 27 03:13:55 GMT 2024

Powered by FUDForum. Page generated in 0.03324 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top