4 Replies Latest reply on Aug 1, 2011 3:37 PM by everjava

    can't load persistence.xml in esb project

    everjava

      I'm not sure if it is about jboss esb ...but...

       

      I have a project where there's entities, it's a jpa project on eclipse. I have other project, now it's an ejb project. I built both as .jar files

      and move it to lib folder on esb project.

       

      So, after  I get a message, in my action class I call an ejb, and when I call a @PersistenceContext(unitName="myUnit") inside my ejb I got:

      java.lang.IllegalArgumentException: Can't find a deployment unit named...

       

      @PersistenceContext(unitName="myUnit")
      protected EntityManager entityManager;

       

      When jboss is loading I don't see myUnit loading, like this:

      15:35:14,076 INFO  [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=sgn2-ear.ear/sgn-entity.jar#sgn-entity

       

       

       

      on .ear project, I have an application.xml where I can config things about packages, modules.. and it is load.

       

      how could I load my persistence.xml when my esb project is loaded ?

        • 1. Re: can't load persistence.xml in esb project
          tcunning

          Where's your persistence.xml stored?    Does it refer to a dataSource or a JDBC URL?  

          • 2. Re: can't load persistence.xml in esb project
            everjava

            My persistence.xml is into a .jar and it refer a datasource. This .jar is a library of my esb project.

             

             

            //a piece of persistence.xml

            <persistence-unit name="senai-entity" transaction-type="JTA">

            <provider>org.hibernate.ejb.HibernatePersistence</provider>

                    <jta-data-source>java:senai</jta-data-source>

                    <properties>     

                        <property name="hibernate.show_sql" value="true" />

                        <property name="jboss.entity.manager.factory.jndi.name" value="java:/myEntityManagerFactory"/>

                        <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />

                    </properties>

            ...

            • 3. Re: can't load persistence.xml in esb project
              everjava

              I'm still struggling with thi s problem

              I have:

               

              myEntitiesproject.jar (meta-inf/persistence.xml)

              myEjbproject.jar

              myWebproject.war

                 - web-inf/lib/myEntitiesproject.jar

               

              myEsbproject.esb

                   - lib/myEntitiesproject.jar, myEjbproject.jar

                   - META-INF/jboss-esb.xml, deployment.xml

              myWebproject.war

              jbm-queue-service.xml

               

              if I just do deploy of myWebproject.war, the persistence.xml is loaded fine

              But, if I do deploy of myWebproject.war inside myEsbproject.esb doesn't load persistence.xml and the ejb files doesn't find persistence unit name

               

              i tried deploy the both projects separated, just myWebproject.war and myEsbproject.esb without .war. The persistence.xml was loaded, but the ejb files doesn't find persistence unit name too

               

              any idea?

              • 4. Re: can't load persistence.xml in esb project
                everjava

                i created an .ear to solved it. doing a deploy of both .ear and .esb and removing myEntitiesproject.jar as library

                 

                 

                myEar.ear:

                myEntitiesproject.jar (meta-inf/persistence.xml)

                 

                myEsbproject.esb:

                     - lib/myEjbproject.jar

                     - META-INF/jboss-esb.xml, deployment.xml

                myWebproject.war

                jbm-queue-service.xml