2 Replies Latest reply on Nov 16, 2006 2:50 AM by Rafal Hudowski

    Problem with deploying entity EJB 3.0 on Jboss

    Rafal Hudowski Newbie

      Hi!
      Jboss 4.0.4 GA with EJB 3.0
      J have a very simple application.
      my-app.ear
      -> Meta-inf
          -> application.xml
      -> app-ejb-1.0.jar
             -> Meta-inf
                -> persistance.xml
             -> company
                -> app
                   -> ejb
                      -> entity
                         -> Document.class
                         -> Scan.class
                      -> session
                         ->TestStatelessBean.class
                   -> interfaces
                      -> TestStatelessBeanLocal.class
      ---------------------------------------------------------------------------------
      Persistance.xml:
      <?xml version="1.0" encoding="UTF-8"?>

      <persistence-unit name="app">
      <jta-data-source>java:appDS</jta-data-source>
      </persistence-unit>


      ------------------------------------------------------------------------------------
      oracle9i-ds.xml (deployed on Jboss):

      <local-tx-datasource>
      <jndi-name>appDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx)(PORT=1521)))(CONNECT_DATA=(SID=yyy)(SRVR=DEDICATED)))
      </connection-url>

      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>

      ...

      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>

      <check-valid-connection-sql>select sysdate from dual</check-valid-connection-sql>


      <type-mapping>Oracle9i</type-mapping>


      </local-tx-datasource>


      J have this connection url( (DESCRIPTION=(ADDRESS....) defined in tnsames.ora so i think it's correct.
      ------------------------------------------------------------------------------

      Document.java:
      @Entity
      @Table(name = "DOCUMENTS")
      public class Document implements java.io.Serializable
      {

      private static final long serialVersionUID = -2324201610375801418L;

      private int doc_id;
      private String name;

      @Id
      public int getDoc_id()
      {
      return doc_id;
      }

      public void setDoc_id(int id)
      {
      this.doc_id = id;
      }

      public String getName()
      {
      return name;
      }

      public void setName(String name)
      {
      this.name = name;
      }
      }

      Scan.java is very similar to Document.java
      -----------------------------------------------------------------------------------

      My problem: Entity beans don't deploy. I see on Jboss:

      [EARDeployer] Init J2EE application: file:/C:/jboss-4.0.4.GA/server/app/deploy/1app-ear-jboss-1.0.ear
      [Ejb3Deployment] EJB3 deployment time took: 15
      [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=1app-ear-jboss-1.0.ear,jar=app-ejb-1.0.jar,name=TestStatelessBean,service=EJB3 with dependencies:
      [EJBContainer] STARTED EJB: comarch.app.ejb.session.TestStatelessBean ejbName: TestStatelessBean
      [EJB3Deployer] Deployed: file:/C:/jboss-4.0.4.GA/server/app/tmp/deploy/tmp542761app-ear-jboss-1.0.ear-contents/app-ejb-1.0.jar
      [EARDeployer] Started J2EE application: file:/C:/jboss-4.0.4.GA/server/app/deploy/1app-ear-jboss-1.0.ear


      When I'm trying add into TestStatelessBean.java:

      @PersistenceContext
      private EntityManager manager;
      i see warning:

      WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=app-ejb-1.0.jar
      java.lang.RuntimeException: Field private javax.persistence.EntityManager comarch.app.ejb.session.TestStatelessBean.manager @PersistenceUnit in error: EMPTY STRING unitName but there is no deployments in scope

      I think my Jboss doesn't see this Entity Beans. Maybe it's a problem with my definition of data source? I don't know how can I verify this data source. In oracle9i-ds.xml is '
      <check-valid-connection-sql>select sysdate from dual
      </check-valid-connection-sql>
      but i can write bad connections (e.g. host which doesn't exist) and this ds is every time deployed on the Jboss without error.
      I haven't got any idea where is the problem.
      Please, help me!
      Rafal