1 Reply Latest reply on Jan 10, 2008 7:49 PM by waynebaylor

    JNDI look up datasource problem

    roman.angelov

      Hi All :),
      Today I tried to build my first ejb 3 (in fact I tried to use Entity and Session EJB - one Session bean calls Entities and make records in the tables). I tried two configurations of database- one for Jboss hybernate and one for Oracle 9i.
      I used these xml files for datasource connections in the deploy folder:
      1. The default hsqldb-ds.xml - the beans work fine (All actions are successful executed)
      2. oracle-ds.xml:
      <?xml version="1.0" encoding="UTF-8"?>

      <!-- The Hypersonic embedded database JCA connection factory config -->

      <!-- $Id: hsqldb-ds.xml 39791 2006-01-10 18:14:42Z dimitris $ -->


      <local-tx-datasource>
      <jndi-name>TestDS</jndi-name>
      <connection-url>jdbc:oracle:thin:@xx.xxx.xx.xx:1521:sidname</connection-url>
      <!--
      See on WIKI page below how to use Oracle's thin JDBC driver to connect with enterprise RAC.
      -->
      <!--
      Here are a couple of the possible OCI configurations.
      For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm

      <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
      or
      <connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>

      Clearly, its better to have TNS set up properly.
      -->
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>user</user-name>
      password

      <min-pool-size>5</min-pool-size>
      <max-pool-size>100</max-pool-size>
      </local-tx-datasource>



      * I changed the username, password, url and the sid name.

      With the second configuration of datasource I have this exeption:

      #####################################

      21:04:37,343 ERROR [AbstractKernelController] Error installing to Start: name=pe
      rsistence.units:ear=chapter8.ear,jar=chapter8-ejb.jar,unitName=actionBazaar stat
      e=Create
      javax.persistence.PersistenceException: org.hibernate.HibernateException: unknow
      n Oracle major version [0]
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Con
      figuration.java:663)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFa
      ctory(HibernatePersistence.java:127)
      at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnit
      Deployment.java:259)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
      java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
      sorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(Reflec
      tionUtils.java:56)
      at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(
      ReflectMethodInfoImpl.java:110)
      ..................................


      ####################################

      I used only persistence.xml in

      with content


      <persistence-unit name="actionBazaar">
      <jta-data-source>java:TestDS</jta-data-source>

      <!-- Uncomment for automatic table creation-->



      </persistence-unit>



      with <jta-data-source>java:DefaultDS</jta-data-source> works fine

      What can be the problem that I cannot use Oracle datasource?

      I use jboss-5.0.0.Beta3 and java 1.5.0_06-b05
      Thanks a lot!