5 Replies Latest reply on Jan 17, 2011 2:03 PM by Ohad Zeliger

    Linkage Error with Weld in two jars (Jboss 6 Final)

    Ohad Zeliger Newbie

      Hi all,


      I've been trying some examples of Weld within Jboss 6.0 Final as a POC for my project. Since our app runs with several EAR files, I've split the Translator example from the Weld examples repository into two EARs. When only one of the EARs contain beans.xml everything seems to work fine. However, when I add beans.xml file to the other EAR (it only has a ejb-jar file, no WAR), JBoss fails to load, giving the following error:


      ...



      Caused by: java.lang.LinkageError: loader (instance of  org/jboss/classloader/spi/base/BaseClassLoader):
        attempted  duplicate class definition for name:
        "org/jboss/weld/examples/translator/web/org$jboss$weld$bean-jboss$classloader:id=
        "vfs:$$$users$oz$projects$weld-example$ear$target$weld-translator-web$ear"
        -NewSessionBean-TranslatorControllerBean_$$_WeldProxy"
          at java.lang.ClassLoader.defineClass1(Native Method)
          at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
          at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
          at java.lang.ClassLoader.defineClass(ClassLoader.java:466)
          at sun.reflect.GeneratedMethodAccessor129.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)l
          at java.lang.reflect.Method.invoke(Method.java:597)
          at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:143)
          at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:109)





      I can provide the sample files, if required. Any help is greatly appreciated.