3 Replies Latest reply on Dec 11, 2008 5:09 AM by atijms

    Problems for ear project configuration and deployment to JBo

    superdev

      I have tested migrating my project form JBoss 4.2.3 GA to Jboss 5 GA, and have the following findings and/or questions:

      1. Contrary to JBoss 4.2.3 GA, No declaration for the jar file containing persistence.xml for Jboss 5 GA, otherwise I will get errors:
      ...
      Caused by: java.lang.IllegalStateException: Context already exists with path 'lib/myLib.jar'
      at org.jboss.deployers.plugins.structure.StructureMetaDataImpl.addContext(StructureMetaDataImpl.java:59)
      ....

      2. Only one **-service.xml file under /META-INF was allowed, while in JBoss 4.2.3 GA, multiple **-service.xml files were allowed. I'm not sure whether the rules has been changed for JBoss GA 5 or I have done something wrong?

      Another small findings: As I use quartz mbean service in my project, I noticed that quartz 1.5.2 is not updated to newer version.

      I wonder whether the items I found is valid, or I have done something wrong. Thanks a lot in advance!

        • 1. Re: Problems for ear project configuration and deployment to
          superdev

          Sorry, seems Item 1 seems is not put out clearly, some explanations for item 1:
          With Jboss 4.2.x, in an EAR, if a .jar file on the classpath contained entities and a persistence.xml, Jboss would not automatically find it. Instead, it had to be added to the meta-inf/application.xml. For example:

          <application>
          ...
           <!--the jar containing the persistence unit -->
           <module>
           <java>lib/myLib.jar</java>
           </module>
          ...
          </application>

          In Jboss 5, you should not declare the jar file containing persistence.xml (and the entity classes) in application.xml anymore. since it's already (apparently) scanned automatically. If you still declare your persistence unit that way, you'll get the following exception/error:
          ...
          Caused by: java.lang.IllegalStateException: Context already exists with path 'lib/myLib.jar'
          at org.jboss.deployers.plugins.structure.StructureMetaDataImpl.addContext(StructureMetaDataImpl.java:59)
          ....


          • 2. Re: Problems for ear project configuration and deployment to
            jaikiran

            The EAR/lib folder is by default added to the classpath of the EAR. So you need not add it as a module in the application.xml. However, i am not sure if it is expected to throw an exception if you add it as a module. I would recommend that you open a new thread in the JBossAS5 forum http://www.jboss.com/index.html?module=bb&op=viewforum&f=287 with the entire exception stacktrace and details and point to this thread.

            • 3. Re: Problems for ear project configuration and deployment to
              atijms

               

              "jaikiran" wrote:
              The EAR/lib folder is by default added to the classpath of the EAR. So you need not add it as a module in the application.xml.


              In Jboss 4.2.x this was really required though. Maybe this was a bug, or maybe this was because Jboss 4.2.x was not 100% Java EE compliant?

              See here: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4078239

              The last comment by mzeijen:


              I discovered that in AS 4.2 with a JEE5 application.xml file all normal jars in the Lib process are added to the classpath but the file containing the persistence.xml needs to be added to the application.xml as a java module.