0 Replies Latest reply on Aug 8, 2011 4:21 PM by Bruno Santos

    How to load modules in a WAB?

    Bruno Santos Newbie

      I'm trying to convert a working war into a wab and I'm having issues with class loading order. To fix it, I've decided to create a small hierarchie of modules.

       

      Module org.red5.base depends on Module org.springframework depends on Module com.springsource.

       

      Example module:

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <module xmlns="urn:jboss:module:1.0" name="org.springframework">

          <resources>

              <resource-root path="org.springframework.asm-3.0.5.RELEASE.jar"/>

              <resource-root path="org.springframework.beans-3.0.5.RELEASE.jar"/>

              <resource-root path="org.springframework.context-3.0.5.RELEASE.jar"/>

              <resource-root path="org.springframework.context.support-3.0.5.RELEASE.jar"/>

              <resource-root path="org.springframework.core-3.0.5.RELEASE.jar"/>

              <resource-root path="org.springframework.expression-3.0.5.RELEASE.jar"/>

              <resource-root path="org.springframework.web-3.0.5.RELEASE.jar"/>

          </resources>

       

          <dependencies>

              <module name="com.springsource"/>

          </dependencies>

      </module>

       

      The MANIFEST.MF for the wab looks like:

       

      Dependencies: org.apache.commons.logging export, org.slf4j export, org.red5.base export

      Bundle-ClassPath: .,

      lib/red5.jar,

      lib/xuggle-xuggler.jar,

      WEB-INF/classes/

      Bundle-ManifestVersion: 2

      Bundle-SymbolicName: red5

      Export-Package: org.red5.server.war

      Import-Package: org.osgi.framework

      Include-Resource: lib

      Web-ContextPath: /red5

       

       

      It seems that the modules are not being loaded and I get the following error:

       

      Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/ContextLoaderListener

                at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_23]

                at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) [:1.6.0_23]

                at java.lang.ClassLoader.defineClass(ClassLoader.java:616) [:1.6.0_23]

                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [:1.6.0_23]

                at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397) [jboss-modules.jar:1.0.1.GA]

                ... 54 more

      Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener from [Module "deployment.red5:0.0.0" from Service Module Loader]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191) [jboss-modules.jar:1.0.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:358) [jboss-modules.jar:1.0.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:330) [jboss-modules.jar:1.0.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:307) [jboss-modules.jar:1.0.1.GA]

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:101) [jboss-modules.jar:1.0.1.GA]

                ... 59 more

       

       

      I'm sure I'm missing something but can't figure what.

       

      Thanks