8 Replies Latest reply on Mar 27, 2014 3:34 PM by Felipe Reis

    OSGI NoClassDefFoundError on dependency between bundles

    Felipe Reis Newbie

      I'm trying to create a bundle which exposes a simple EJB that will be consumed by bundle with a JSF page.

       

       

      The EJB bundle was deployed correctly, I got the following in the server log:

       

       

        java:global/osgi-ejb/Echo!ejb.services.Echo

        java:app/osgi-ejb/Echo!ejb.services.Echo

        java:module/Echo!ejb.services.Echo

        java:global/osgi-ejb/Echo

        java:app/osgi-ejb/Echo

        java:module/Echo

       

       

      However, when I try to deploy the WEB Bundle I get the following error:

       

       

          Caused by: java.lang.ClassNotFoundException: ejb.services.Echo from [Module "deployment.osgi-web.war:main" from Service Module Loader]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]

        ... 15 more

       

       

      My EJB is located in the package `ejb.services` and is called `Echo`

       

       

      The Bundles' MANIFEST look correct

       

       

      EJB

       

       

          Manifest-Version: 1.0

          Export-Package: ejb.services;uses:="javax.ejb"

          Built-By: felipereis

          Tool: Bnd-1.15.0

          Bundle-Name: EJB Osgi

          Created-By: Apache Maven Bundle Plugin

          Bundle-Version: 0.0.1.SNAPSHOT

          Build-Jdk: 1.7.0_09

          Bnd-LastModified: 1395105941590

          Bundle-ManifestVersion: 2

          Bundle-Activator: ejb.activator.Activator

          Bundle-SymbolicName: osgi-ejb

          Import-Package: javax.ejb;version="[3.1,4)",org.osgi.framework;version

           ="[1.5,2)"

       

       

       

       

      WEB

       

       

          Manifest-Version: 1.0

          Webapp-Context: osgi-web

          Bundle-ClassPath: WEB-INF/classes

          Built-By: felipereis

          Tool: Bnd-1.15.0

          Bundle-Name: Web Osgi

          Created-By: Apache Maven Bundle Plugin

          Web-ContextPath: /osgi-web

          Build-Jdk: 1.7.0_09

          Bundle-Version: 0.0.1.SNAPSHOT

          Bnd-LastModified: 1395105347301

          Bundle-Activator: web.activator.Activator

          Bundle-ManifestVersion: 2

          Embed-Dependency: *;scope=compile|runtime

          Import-Package: ejb.services,org.osgi.framework;resolution:=optional;v

           ersion="[1.5,2)"

          Bundle-SymbolicName: osgi-web

          Archiver-Version: Plexus Archiver

       

       

       

      I'm using Wildfly 8.0.0.Final