3 Replies Latest reply on Oct 14, 2004 6:40 AM by lindsay_h

    Classpath problems - Beans from one ear are using the JARs f

    lindsay_h Newbie

      Hello,

      I have one ear (hehe) - let's call it ear1 - that deploys fine and has lots of beans in it that do stuff and everything's fab.

      I have another ear - ear2 - that, when deployed on it's own, works fine too.

      But when I deploy them both, the beans from ear1 are using classes that are contained in a jar in ear2!

      Both ears contain jars that they need to do their business, and they both contain a jar called utility.jar. When I was making changes to the application that is ear1, I made changes to a few classes in utility.jar and rebuilt the whole lot into ear1. But I did not rebuild ear2 to use the new utility.jar (I thought I shouldn't have to because the ear2 application hadn't been modified - so it should continue to work as normal using the 'old' utility.jar file held within the ear).

      So, now that ear1 uses the new utility.jar and ear2 uses the old utility.jar, when I deploy both ears at once and try using a bean in ear1 it throws a NoSuchMethodError when the bean tries to use one of my new utility.jar's methods. This can only because it is somehow looking at the jar from ear2.

      I can confirm that I have checked to ensure ear1 definitely does contain the new utility.jar and it does. And as I said before, both ears work fine when deployed separately.

      BTW, I am using application.xml to specify the JARs used by each ear. I'm using separate module elements for each JAR. i.e.

      <module>
       <java>lib/utility.jar</java>
      </module>
      <module>
       <java>lib/3rdParty/log4j.jar</java>
      </module>
      ...
      


      If anyone can shed any sort of light on this weird phenomenon, you'd really make my day :D

      Thanks,

      Lindsay