3 Replies Latest reply on Feb 25, 2004 7:15 AM by alaveth

    Datasource  link to  -> java:/DefaultDS

    ralph1 Newbie

      Hi *

      still fighting with a problem reported may time, but i am looking for a solution.

      I am using jboss3.2.3 with an oracle 9i.

      1) i created an oracle-xa-ds.xml file in the default/deploy dir :

      <xa-datasource>
      <jndi-name>XAOracleDS</jndi-name>

      2.) i modified the standardjbosscmp-jdbc.xml in the default/conf dir

      java:/XAOracleDS
      <datasource-mapping>Oracle9i</datasource-mapping>

      3.) I copied ojdbc14.jar to lib dir.

      4.) my ejb-jar.xml looks like

      <ejb-name>ProjManager</ejb-name>
      ProjManagerHome
      ProjManager
      <ejb-class>ProjManagerBean</ejb-class>
      <transaction-type>Container</transaction-type>
      <session-type>Stateless</session-type>
      <resource-ref>
      <res-ref-name>jdbc/XAOracleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>


      5.) my jboss.xml looks like
      <resource-managers>
      <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">
      <res-name>OraDB</res-name>
      <res-jndi-name>XAOracleDS</res-jndi-name>
      </resource-manager>
      </resource-managers>

      <enterprise-beans>


      <ejb-name>ProjManager</ejb-name>
      <jndi-name>ims/ProjManager</jndi-name>
      <resource-ref>
      <res-ref-name>jdbc/XAOracleDS</res-ref-name>
      <resource-name>OraDB</resource-name>
      </resource-ref>


      6.) my bean code fpr dbconnection is
      DataSource source = ( DataSource )new InitialContext().lookup( "java:comp/env/jdbc/XAOracleDS" );
      return source.getConnection();

      if i deploy the ear file to jboss and have a look to the jmx-console i get
      java:comp namespace of the ProjManager bean:

      +- env (class: org.jnp.interfaces.NamingContext)
      | +- jdbc (class: org.jnp.interfaces.NamingContext)
      | | +- XAOracleDS[link -> java:/DefaultDS] (class: javax.naming.LinkRef)

      as datasource i expect the XAOracleDS and not the DefaultDS

      the only place where i find the DefaultDS is the hsqldb-ds.xml in the deploy directory.

      If i run the bean i get a JDBC not bound.


      Whats wrong with my code ??

      Kind regards
      Ralph