2 Replies Latest reply on Oct 15, 2004 11:06 AM by hoguester

    Classloader problems with commons-collections.

    hoguester

      I have an EAR in which I have an application that uses Cayenne. Cayenne needs commons-collections3.x to work properly. I am deploying the EAR in exploded format.

      app.EAR
      |
      core.jar
      |
      lib
      |
      commons-collections-3.1.jar
      cayenne-no-deps.jar

      Cayenne, however, is not working because it is picking up an older version of commons-collectons that's in jbossweb-tomcat50.sar.

      I also have a 2 web apps deployed as a wars outside the ear.

      2 Questions:

      1. Why is the code in the EAR picking up the commons jar in the tomcat.sar instead of the commons jar in the ear - how can i prevent this behavior?

      2. Can I scope it so that the WAR's can see the EAR (I want to use local interfaces for my EJB access), but the EAR can't see the WAR's and the WAR's can't see each other?

      Thanks,

      Brian

        • 1. Re: Classloader problems with commons-collections.
          wonnekeysers

          You'll indeed have to use scoped class loading.
          See http://www.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration...

          • 2. Re: Classloader problems with commons-collections.
            hoguester

            Thanks -

            I did try that - both with jboss-app and the jboss-service - and in both instances I got

            2004-10-15 09:56:41,804 ERROR [org.jboss.ejb.StatelessSessionContainer] Initialization failed jboss.j2ee:jndiName=ejb/service/remote/EmployeeService,service=EJB
            java.lang.ClassCastException
            at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.getEJBLocalHome(BaseLocalProxyFactory.java:210)
            at org.jboss.ejb.Container.createService(Container.java:581)
            at org.jboss.ejb.StatelessSessionContainer.createService(StatelessSessionContainer.java:133)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:237)
            at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:219)

            when it tried to deploy my EJB. The EJB is in a JAR in the EAR - so I dont understand why the ClassCastException?

            My setting from the jboss-service is : (with "<>'s" removed)

            !-- EAR deployer, remove if you are not using Web layers --
            mbean code="org.jboss.deployment.EARDeployer" name="jboss.j2ee:service=EARDeployer"
            !-- Isolate all ears in their own classloader space --
            attribute name="Isolated">true/attribute
            /mbean