[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] ClassNotFoundException While Deserializing in OSGi Bundles

Hi!

In an OSGi bundle (called net.beaconcontroller.cluster), I have a
org.jgroups.blocks.ReplicatedHashMap of type <Long,
net.beaconcontroller.cluster.ControllerInfo>. The problem is, during
dispatching (that is, deserialization of ControllerInfo on the
remote end) JGroups complains with ClassNotFoundException. (Stack
trace is attached.) Adding

--8<---------------cut here---------------start------------->8---
Thread.currentThread().setContextClassLoader(Cluster.class.getClassLoader())
--8<---------------cut here---------------end--------------->8---

line to the startUp() method of the net.beaconcontroller.cluster
bundle did have no effects. What might I be missing?

--8<---------------cut here---------------start------------->8---
Caused by: java.lang.ClassNotFoundException: net.beaconcontroller.cluster.ControllerInfo
        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:506) ~[na:na]
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) ~[na:na]
        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410) ~[na:na]
        at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107) ~[na:na]
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ~[na:1.6.0_30]
        at java.lang.Class.forName0(Native Method) ~[na:1.6.0_30]
        at java.lang.Class.forName(Class.java:247) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:603) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350) ~[na:1.6.0_30]
        at java.util.HashMap.readObject(HashMap.java:1030) ~[na:1.6.0_30]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_30]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_30]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_30]
        at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_30]
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1848) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328) ~[na:1.6.0_30]
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350) ~[na:1.6.0_30]
        at org.jgroups.blocks.ReplicatedHashMap.setState(ReplicatedHashMap.java:540) ~[na:na]
        at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.handleUpEvent(MessageDispatcher.java:497) ~[na:na]
        at org.jgroups.blocks.MessageDispatcher$ProtocolAdapter.up(MessageDispatcher.java:558) ~[na:na]
--8<---------------cut here---------------end--------------->8---


Best.