2 Replies Latest reply on Dec 14, 2005 9:50 AM by Vitor Isaia

    linkageError with duplicate jar files

    Vitor Isaia Newbie

      I'm facing the following problem:

      I have 2 applications, an EAR file and a WAR file. Both files use jfreechart and jcommon jars, and, as the EAR, the WAR have the jfree and jcommon jars packed inside it. So I have this structure:

      EAR
      |-jcommon.jar
      |-jfreechart.jar

      WAR
      |-jcommon.jar
      |-jfreechart.jar


      I'm using JBOSS 4.0.3SP1 version, in WinXP.

      but I'm facing the problem that when I call the function to generate graphics (that need to use the the jcommon and jfreechart jars), I have a
      "java.lang.LinkageError: loader constraints violated when linking ... (name of jfreechart package)"... so I realize that I can't have these jar duplicated in the EAR and in the WAR... to fix the problem I've extracted them from the ear and the war and putted in server/default/lib... but that is not a good thing...

      Anyone have any idea for solving this problem? I really need to use that structure I discribed before...

      thanks a lot...

      Vitor Isaia
      Brasil

        • 1. Re: linkageError with duplicate jar files
          Maarten Roosendaal Newbie

          Is your WAR part of you EAR?

          if so just make a lib under the EAR and put the jars there
          update the MANIFEST-file for your WAR-file:
          Manifest-Version: 1.0
          Ant-Version: Apache Ant 1.6.5
          Created-By: 1.4.2_08-b03 (Sun Microsystems Inc.)
          Class-Path: ./lib/a.jar ./lib/b.jar ./lib/etc...

          If you want i can post the ANT-target i used.

          If not then they reside in different Classloaders and it shouldn;t be a problem. Linkage errors usually have to do with Classloader scoping.

          • 2. Re: linkageError with duplicate jar files
            Vitor Isaia Newbie

            mroosendaal, thanks for the reply. The war is not a part of the ear, but the war interacts with the ear... they are built and deployd separatelly, but in runtime the war calls the ejbs that are present in the ear... thanks for the ant target, but I think my build.xml already do something very close to that...

            just a note, I didn't have this problem until I upgraded to jboss 4.0.3sp1 (we were using the 4.0.3 version), do you think this can be a problem?

            thanks a lot.
            Regards,
            Vitor Isaia - Brasil