4 Replies Latest reply on May 26, 2011 12:30 PM by dhartford

    Marking a session bean as having pojo dependencies (jboss7/ejb-jar.xml)?

    dhartford

      Hey all,

      I have an existing .EAR that I'm playing around with on Jbossas7-beta3.

       

      The question may not necessarily be specific to jbossas7, but it is surfacing there -- I have a session bean that depends on a seperate JAR that contains business objects that are not Entity Beans.

       

      When the ejb-jar gets loaded, I'm seeing 'NoClassDefFoundError' for the business object classes that are contained in the pojo jar.  Now, this EAR on jboss6 and prior loads and works fine, but the new loader approach might be eagerly loading all items in parrallel causing some new challenges I haven't come across. The jar's and ejb's are defined in the app.xml.

       

       

       

      Question is: is there a way in ejb-jar.xml, app.xml, or annotation, or maybe container-specific (jboss*.xml) that tells the EJB jar that is has a dependency on a regular (non-ejb/non-jpa) jar so that should be loaded first?

       

      thanks!

       

      -D

        • 1. Re: Marking a session bean as having pojo dependencies (jboss7/ejb-jar.xml)?
          jaikiran

          darren hartford wrote:

           

          The question may not necessarily be specific to jbossas7, but it is surfacing there -- I have a session bean that depends on a seperate JAR that contains business objects that are not Entity Beans.

           

          When the ejb-jar gets loaded, I'm seeing 'NoClassDefFoundError' for the business object classes that are contained in the pojo jar. 

          Where exactly is that jar located in the .ear? If you place that pojo jar in .ear/lib folder (if there isn't a .ear/lib folder, then create one) then all the jars in that lib folder will be available in the classpath of the entire application.

          1 of 1 people found this helpful
          • 2. Re: Marking a session bean as having pojo dependencies (jboss7/ejb-jar.xml)?
            dhartford

            Thanks for the tip above - moving to /lib/ seems to at least make it closer...

             

             

            This seems to have shifted the issue -- now getting

             

            10:55:49,998 INFO  [org.jboss.as.server] (MSC service thread 1-4) Service status report

               New missing/unsatisfied dependencies:

                  service jboss.deployment.subunit."app.ear"."lib/pojo.jar".STRUCTURE (missing)

             

             

            10:55:50,033 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) Stopped deployment lib/pojo.jar in 27ms

             

             

            10:55:53,475 INFO  [org.jboss.as.server] (MSC service thread 1-4) Service status report

               Newly corrected services:

                  service jboss.deployment.subunit."app.ear"."lib/pojo.jar".STRUCTURE (no longer required)

             

             

             

            This is with application.xml defined with:

              <module>

                <java>lib/pojo.jar</java>

              </module>

             

            and the app.ear/lib/pojo.jar file location within the ear (as in, you open the .ear and you see /lib/pojo.jar)

             

             

            EDIT: if it matters, this was in the log prior to the above --

            11:02:10,381 WARN  [org.jboss.vfs] (MSC service thread 1-4) VFS was unable to set the URLStreamHandlerFactory.  This will have unpredictable results

             

            this is fedora 14, default install, openjdk 1.6.0_20, jboss 7-beta-3, standalone deployment

            • 3. Re: Marking a session bean as having pojo dependencies (jboss7/ejb-jar.xml)?
              jaikiran

              darren hartford wrote:

               

               

              This is with application.xml defined with:

                <module>

                  <java>lib/pojo.jar</java>

                </module>

              Remove that mapping from application.xml. A "java" module is actually a Java EE "application client" which is not what you want. The jars within .ear/lib are by default available in classpath, so you don't have to do anything extra other than just placing those jars there.

              • 4. Re: Marking a session bean as having pojo dependencies (jboss7/ejb-jar.xml)?
                dhartford

                thanks, moving to the /lib/ and removing the mapping in the application.xml resolved the issue.

                 

                I'm migrating from jboss 4.0.5, and I think I had the EAR setup the current way for a reason, but do not recall exactly. Anyway, now deploying, thanks!