1 Reply Latest reply on Oct 17, 2003 10:33 AM by Adrian Brock

    Binding ConnectionFactory to java:/comp/env namespace

    Sandeep Rajpathak Newbie

      I have basically coded a Resource Adapter which is required to work on WebLogic, WebSphere, Oracle 9, SUN One and JBoss application server.

      I am binding the ConnectionFactory of my RA to a particular name. In case of all the other app. servers, the factory get bound to java:/comp/env/. However in case of JBoss it get bound to java:/

      Obviously I want to avoid writing Application Server specific code in my adapter.

      Is there any way by which I can bind to java:/comp/env namespace. I read a lot posting about this but none of them mentioned how to do it.

      I am using JBoss 3.2.1 and following is my TestConnector-ds.xml

      ----------------------------

      <?xml version="1.0" encoding="UTF-8"?>

      <connection-factories>
      <no-tx-connection-factory>
      <jndi-name>mytest/connector</jndi-name>
      <adapter-display-name>Test Connector</adapter-display-name>

      <!-- If you supply the usr/pw from a JAAS login module -->
      <security-domain/>

      <!-- if your app supplies the usr/pw explicitly getConnection(usr, pw) -->
      <application-managed-security/>

      </no-tx-connection-factory>
      </connection-factories>

      --------------------------------------------

        • 1. Re: Binding ConnectionFactory to java:/comp/env namespace
          Adrian Brock Master

          This configuration is done per bean:

          ejb-jar.xml


          <ejb-name>UnshareableStateful</ejb-name>

          <local-home>org.jboss.test.jca.interfaces.UnshareableConnectionStatefulLocalHome</local-home>

          org.jboss.test.jca.interfaces.UnshareableConnectionStatefulLocal

          <ejb-class>org.jboss.test.jca.ejb.UnshareableConnectionStatefulBean</ejb-class>

          <session-type>Stateful</session-type>

          <transaction-type>Bean</transaction-type>
          <resource-ref>
          <res-ref-name>jdbc/DataSource</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
          </resource-ref>



          jboss.xml
          <?xml version="1.0" encoding="UTF-8"?>





          <enterprise-beans>

          <ejb-name>UnshareableStateful</ejb-name>
          <resource-ref>
          <res-ref-name>jdbc/DataSource</res-ref-name>
          <resource-name>DefaultDS</resource-name>
          </resource-ref>

          </enterprise-beans>

          <resource-managers>
          <resource-manager res-class="">
          <res-name>DefaultDS</res-name>
          <res-jndi-name>java:/DefaultDS</res-jndi-name>
          </resource-manager>
          </resource-managers>