0 Replies Latest reply on Oct 26, 2013 6:38 PM by Ignacio de Cordoba

    java.lang.LinkageError using a module for common jars in multiple applications

    Ignacio de Cordoba Novice

      Hello,

      I have multiple war applications deployed in my JBoss 7.1: Most of them use same jars, which so far I've placed in WEB-INF/lib dir.

      I've learnt about JBoss modules, so I've decided to give it a try and put common jars (PrimeFaces, ...) in a module (in modules dir... my module/main/...

      My problem is that even adding the dependency content in module.xml, module jars depending, for example, in JEE classes, will return a java.lang.LinkageError + ClassNotFound exception.

      I've read all docs available on modules and class loading, also tried including the dependencies in MANIFEST.MF  in the war file but no difference. Thanks for any ideas

       

       

      (Stacktrace)

      In module's module.xml file, I'm doing:

              <dependencies>

                      <module name="javaee.api"/>

              </dependencies>

       

      but still get:

       

      00:19:30,844 WARN  [org.jboss.modules] (MSC service thread 1-11) Failed to define class org.primefaces.event.FileUploadEvent in Module "net.aphonic:main" from local module loader @2d1ac44d (roots: /home/jboss/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/modules): java.lang.LinkageError: Failed to link org/primefaces/event/FileUploadEvent (Module "net.aphonic:main" from local module loader @2d1ac44d (roots: /home/jboss/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/modules))

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)

        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)

        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)

        at org.jboss.modules.Module.loadModuleClass(Module.java:527)

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

        at java.lang.Class.getDeclaredMethodsImpl(Native Method) [vm.jar:1.7.0]

        at java.lang.Class.getDeclaredMethods(Class.java:783) [vm.jar:1.7.0]

        at org.jboss.weld.util.reflection.SecureReflections$8.work(SecureReflections.java:175) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.util.reflection.SecureReflections$8.work(SecureReflections.java:172) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.util.reflection.SecureReflectionAccess.runAndWrap(SecureReflectionAccess.java:63) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.util.reflection.SecureReflections.getDeclaredMethods(SecureReflections.java:172) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.introspector.jlr.WeldClassImpl.<init>(WeldClassImpl.java:234) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.introspector.jlr.WeldClassImpl.of(WeldClassImpl.java:119) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:59) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.resources.ClassTransformer$TransformTypeToWeldClass.apply(ClassTransformer.java:50) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at com.google.common.collect.ComputingConcurrentHashMap$ComputingValueReference.compute(ComputingConcurrentHashMap.java:355)

        at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.compute(ComputingConcurrentHashMap.java:184)

        at com.google.common.collect.ComputingConcurrentHashMap$ComputingSegment.getOrCompute(ComputingConcurrentHashMap.java:153)

        at com.google.common.collect.ComputingConcurrentHashMap.getOrCompute(ComputingConcurrentHashMap.java:69)

        at com.google.common.collect.ComputingConcurrentHashMap$ComputingMapAdapter.get(ComputingConcurrentHashMap.java:393)

        at org.jboss.weld.resources.ClassTransformer.loadClass(ClassTransformer.java:163) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.bootstrap.BeanDeployer.loadWeldClass(BeanDeployer.java:108) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.bootstrap.BeanDeployer.addClass(BeanDeployer.java:79) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.bootstrap.BeanDeployer.addClasses(BeanDeployer.java:123) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:184) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:350) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]

        at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82) [jboss-as-weld-7.1.2.Final.jar:7.1.2.Final]

        at org.jboss.as.weld.services.WeldService.start(WeldService.java:76) [jboss-as-weld-7.1.2.Final.jar:7.1.2.Final]

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)

        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0]

        at java.lang.Thread.run(Thread.java:781) [vm.jar:1.7.0]

      Caused by: java.lang.NoClassDefFoundError: javax.faces.event.FacesEvent

        at java.lang.ClassLoader.defineClassImpl(Native Method) [vm.jar:1.7.0]

        at java.lang.ClassLoader.defineClass(ClassLoader.java:306) [vm.jar:1.7.0]

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:143) [rt.jar:1.7.0]

        at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

        ... 37 more

      Caused by: java.lang.ClassNotFoundException: javax.faces.event.FacesEvent from [Module "net.aphonic:main" from local module loader @2d1ac44d (roots: /home/jboss/mss-2.0.0.FINAL-jboss-as-7.1.2.Final/modules)]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

        ... 42 more