1 Reply Latest reply on Jul 28, 2005 10:29 AM by Gary Cuozzo

    JBoss 4.02 with Hibernate2

    siva arumugam Newbie

      I am trying to setup Hibernate2 in JBoss4.0.2.

      I have a SAR file for hibernate service with the following contents:
      -----------------------------------------------------------------------------

      /meta-inf/jboss-service.xml

      <server>
       <mbean code="net.sf.hibernate.jmx.HibernateService" name="OneNetwork.SSO:Database Manager=SSO Hibernate Service">
       <depends>jboss.jca:service=RARDeployer</depends>
       <depends>jboss.jca:service=LocalTxCM,name=OracleDS</depends>
       <attribute name="MapResources">
       model/Application.hbm.xml,
       </attribute>
       <attribute name="JndiName">java:/hibernate/HibernateFactory</attribute>
       <attribute name="Datasource">java:/OracleDS</attribute>
       <attribute name="Dialect">net.sf.hibernate.dialect.Oracle9Dialect</attribute>
       <attribute name="TransactionStrategy">net.sf.hibernate.transaction.JTATransactionFactory</attribute>
       <attribute name="TransactionManagerLookupStrategy">net.sf.hibernate.transaction.JBossTransactionManagerLookup</attribute>
       <attribute name="MaximumFetchDepth">0</attribute>
       <attribute name="ShowSql">false</attribute>
       </mbean>
      </server>
      



      /lib
      cglib-full-2.0.2.jar
      classes12.jar
      commons-collections-2.1.1.jar
      commons-logging-1.0.4.jar
      dom4j-1.4.jar
      ehcache-0.9.jar
      hibernate2.jar
      odmg-3.0.jar

      ..and my application classes..

      When I start JBOss, I see the following error:

      08:04:47,228 FATAL [DatasourceConnectionProvider] Could not find datasource: java:/OracleDS
      javax.naming.NameNotFoundException: OracleDS not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at net.sf.hibernate.connection.DatasourceConnectionProvider.configure(DatasourceConnectionProvider.java:44)

      The weird thing is I see the following message after the abover error:

      08:04:47,389 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss
      .jca:name=OracleDS,service=DataSourceBinding to JNDI name 'java:OracleDS'

      It's odd to see hibernate service being initialized before initializing OracleDS. I have defined a dependency in hibernate service to wait until OracleDS is ready.

      This exact hibernate configuration works fine in JBoss 3.0.4. The only difference between my JBoss3.0.4 and JBoss4.0.2 is the way we define OracleDS. In JBoss3.0.4 we used oracle-service.xml, in JBoss4.0.2 we used oracle-ds.xml.


      Here is my oracle-ds.xml:

      <datasources>
       <local-tx-datasource>
       <jndi-name>OracleDS</jndi-name>
       <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
       <user-name>dtb62</user-name>
       <password>password</password>
       </local-tx-datasource>
      </datasources>


      I am stuck with this problem. Any help is appreciated.

      Thanks.

        • 1. Re: JBoss 4.02 with Hibernate2
          Gary Cuozzo Newbie

          Hmm, I am having the exact same issue on JBoss4.0.2 with Jbpm. I thought it was something related to how Jbpm was packaged and have a post on their forum. I have been trying to repackage Jbpm to be a self-contained EAR file with it's own classloader but this issue has kept me from being able to do so.

          I don't have this problem if I don't add loader-repository tags and I deploy the DS separately from the SAR. If I can figure out the issue, I'll post here as this seems to be a JBoss problem and not a Jbpm one.

          gary.