7 Replies Latest reply on Nov 19, 2006 5:57 AM by jactor

    Deployment dependencies...

      I am having trouble deploying a session bean and three entity beans.
      I use jboss-4.0.4.GA.

      This is part of another issue (http://www.jboss.org/index.html?module=bb&op=viewtopic&t=91339) which troubles me. I get this is my log:

      --- MBeans waiting for other MBeans ---
      ObjectName: jboss.j2ee:jar=concept.jar,name=EntityServiceBean,service=EJB3
      State: NOTYETINSTALLED
      I Depend On:
      persistence.units:unitName=proof

      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: persistence.units:unitName=proof
      State: NOTYETINSTALLED
      Depends On Me:
      jboss.j2ee:jar=concept.jar,name=EntityServiceBean,service=EJB3


      This is the persistence.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <persistence>
       <persistence-unit name="proof">
       <jta-data-source>java:/DefaultDS</jta-data-source>
       <properties>
       <property name="hibernate.hbm2ddl.auto" value="create-drop" />
       </properties>
       </persistence-unit>
      </persistence>


      This is the declaration of the entity manager in my session bean:
      @PersistenceContext(unitName = "proof")
       protected EntityManager manager = null;
      


      What might be causing that the persistence unit is not getting deployed?

        • 1. Re: Deployment dependencies...

          I discovered the solution for this deployment.

          The unitName in the annotation is no longer working and must be declared as name...

          • 2. Re: Deployment dependencies...

            I thought I found the solution...

            I am one step closer, but now this is the case:

            --- MBeans waiting for other MBeans ---
            ObjectName: jboss.j2ee:service=EJB3,module=concept.jar
            State: FAILED
            Reason: java.lang.RuntimeException: Field protected javax.persistence.EntityManager concept.service.EntityServiceBean.manager @PersistenceUnit in error: EMPTY STRING unitName but there is no deployments in scope

            ObjectName: jboss.j2ee:module=concept.jar,uid=4684622,service=EJB3
            State: FAILED
            Reason: java.lang.RuntimeException: Field protected javax.persistence.EntityManager concept.service.EntityServiceBean.manager @PersistenceUnit in error: EMPTY STRING unitName but there is no deployments in scope

            --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
            ObjectName: jboss.j2ee:module=concept.jar,uid=4684622,service=EJB3
            State: FAILED
            Reason: java.lang.RuntimeException: Field protected javax.persistence.EntityManager concept.service.EntityServiceBean.manager @PersistenceUnit in error: EMPTY STRING unitName but there is no deployments in scope

            ObjectName: jboss.j2ee:service=EJB3,module=concept.jar
            State: FAILED
            Reason: java.lang.RuntimeException: Field protected javax.persistence.EntityManager concept.service.EntityServiceBean.manager @PersistenceUnit in error: EMPTY STRING unitName but there is no deployments in scope


            I am creating a jar including all the beans except the MBean. I am creating a sar including the MBean and the jar created earlier. Both of these files are copied into the deploy folder and this error message is logged... Since the name of the jar was concept, I renamed the name of the persistence unit to be concept, but this did not help. My code now:
            <?xml version="1.0" encoding="UTF-8"?>
            <persistence>
             <persistence-unit name="concept">
             <jta-data-source>java:/DefaultDS</jta-data-source>
             <properties>
             <property name="hibernate.hbm2ddl.auto" value="create-drop" />
             </properties>
             </persistence-unit>
            </persistence>
            ...
             @PersistenceContext(name = "concept", unitName = "concept")
             protected EntityManager manager = null;


            • 3. Re: Deployment dependencies...

              ... and my frustration is growing...

              I restarted the server and then experienced another error:

              --- MBeans waiting for other MBeans ---
              ObjectName: jboss.j2ee:module=concept.jar,uid=31374579,service=EJB3
              State: FAILED
              Reason: java.lang.RuntimeException: javax.management.InstanceAlreadyExistsException: jboss.j2ee:jar=concept.jar,name=EntityServiceBean,service=EJB3 already registered.

              --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
              ObjectName: jboss.j2ee:module=concept.jar,uid=31374579,service=EJB3
              State: FAILED
              Reason: java.lang.RuntimeException: javax.management.InstanceAlreadyExistsException: jboss.j2ee:jar=concept.jar,name=EntityServiceBean,service=EJB3 already registered.


              It seems that the service is installed when deploying my sar which is not reacting to its own dependencies (the original issue). My service xml file:
              <?xml version="1.0" encoding="UTF-8"?>
              
              <server>
               <mbean code="concept.jmx.Checker" name="concept:jmx=concept.jmx.Checker">
               </mbean>
               <depends-list>
               <depends>
               jboss.j2ee:jar=concept.jar,name=EntityServiceBean,service=EJB3
               </depends>
               <depends>persistence.units:unitName=concept</depends>
               </depends-list>
              </server>


              Can anyone come with a suggestion of how o solve this? Do I need to make my deployer sleep between deploying my jar and sar, to be sure that the jar is installed when the sar file is deployed? This is an ugly solution and I am open for other suggestions.

              • 4. Re: Deployment dependencies...
                bill.burke

                please describe how you have packaged your application. Are things in an EAR? If not, what is in which jars?

                Also,

                @PersistenceContext.name() corresponds to the ENC name. The JNDI lookup name in the EJB's ENC. i.e. : jndi.lookup("java:comp/env/THENAME")


                The unitName() corresponds to the unit name defined in persistence.xml

                • 5. Re: Deployment dependencies...

                  > please describe how you have packaged your application. Are things in an
                  > EAR? If not, what is in which jars?
                  As I mentioned earlier:

                  I am creating a jar including all the beans except the MBean. I am creating a sar including the MBean and the jar created earlier. Both of these files are copied into the deploy folder and this error message is logged... Since the name of the jar was concept, I renamed the name of the persistence unit to be concept, but this did not help.
                  This is: I deploy a jar (all beans except MBean and Interface) and a sar (MBean and Interface which includes the jar)

                  > Also,
                  > @PersistenceContext.name() corresponds to the ENC name.
                  What is the ENC name? Do I need to configure this somewhere?
                  > The JNDI lookup name in the EJB's ENC. i.e. : jndi.lookup("java:comp/env/THENAME")
                  I am using annotations and not JNDI lookup.

                  > The unitName() corresponds to the unit name defined in persistence.xml

                  • 6. Re: Deployment dependencies...
                    murilo_fla

                    Hi There.
                    I was with this same problem, and after many hours, I found out what was wrong, at least, in my case.
                    In my case this error ocurred because the EJB jar file was not very fine. I am creating the jar file using the ant "jar" task, and I was inserting the META-INF subdirectory using the "zipfileset" task. Althought I was able to open the jar file and see the META-INF inside it, I got some warnings about it in the Linux command line zip command.
                    When I changed the "zipfileset" for the "fileset" task, the problem desapeared. See my ant tasks:
                    before:

                    <jar jarfile="${build.deploy.dir}/${jar.file}">
                     <zipfileset dir="conf" includes="**" prefix="META-INF"/>
                     <fileset dir="${build.dir}" includes="**/*"/>
                    
                     </jar>


                    after (with the conf files properly moved):

                    <jar jarfile="${build.deploy.dir}/${jar.file}">
                     <fileset dir="conf" includes="META-INF/**"/>
                     <fileset dir="${build.dir}" includes="**/*"/>
                    
                     </jar>


                    I know this case is very specific, but maybe you should check your JAR file's META-INF integrity.
                    Remembering that in my case it was not very clear that it had inconsistency, because graphical Zip programs could read it nicely.

                    Cheers
                    Murilo

                    • 7. Re: Deployment dependencies...

                      Thanx for the reply!

                      I am sorry to say that I have not modified this thread after discovering the problem. I had a typo in my xml and am frustrated over not noticing this earlier.

                      Your suggestion is good. My ant-task is simular to your fix, so this has never been an issue. I did not know you could use the zipfileset.

                      I am discovering that lot of my issues are never answered in this forum, so I am a bit disappointed by the response of some of my issues. Thanx for your answe...