2 Replies Latest reply on Feb 13, 2014 1:05 AM by Paul Durrand

    Classpath issues. ClassNotFound errors

    Paul Durrand Newbie

      Hi,

       

      I am running apache-servicemix-4.4.0-fuse-00-43 on CentOS.

       

      I am having a issue (I think with class loading). I has a few OSGI packages written. One of them is a REST service (A) which calls a Data Layer package(B). Both of these packages import a third package which defines the data types used(C).

       

      I see the following error:

       

      Caused by: java.lang.ClassNotFoundException: com.mycompany.package.type.Product

              at java.net.URLClassLoader$1.run(URLClassLoader.java:202)[:1.6.0_31]

              at java.security.AccessController.doPrivileged(Native Method)[:1.6.0_31]

              at java.net.URLClassLoader.findClass(URLClassLoader.java:190)[:1.6.0_31]

              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)[:1.6.0_31]

              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_31]

              at org.apache.felix.framework.ModuleImpl.doImplicitBootDelegation(ModuleImpl.java:1570)

              at org.apache.felix.framework.ModuleImpl.searchDynamicImports(ModuleImpl.java:1507)

              at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:759)

              at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)

              at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1806)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:247)[:1.6.0_31]

              at java.lang.Class.forName0(Native Method)[:1.6.0_31]

              at java.lang.Class.forName(Class.java:247)[:1.6.0_31]

              at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:603)[:1.6.0_31]

              at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)[:1.6.0_31]

              at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)[:1.6.0_31]

              at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)[:1.6.0_31]

              at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)[:1.6.0_31]

              at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)[:1.6.0_31]

              at org.apache.commons.lang.SerializationUtils.deserialize(SerializationUtils.java:163)[243:org.apache.commons.lang:2.7.0.SNAPSHOT]

       

       

      I have done package:exports on all packages and they all appear to export only their own packages (including the one I required).

       

      I have also done a package:imports on all packages and they all appear to get the correct packages from the correct bundles.

       

      None of the bundles fail to start. The error occurs at runtime.

       

      Does anyone have any ideas?