4 Replies Latest reply on Oct 10, 2003 7:55 AM by klyall

    link -> java:/DefaultDS

    klyall

      When I add a datasource and then reference it from an EJB using a resource-ref tag, it always shows up as OracleDS[link -> java:/DefaultDS] where DefaultDS is the embedded HypersonicSQL database.

      Why does it show this?

      Does this mean that my EJB will be talking to the DefaultDS instead of my new OracleDS?

        • 1. Re: link -> java:/DefaultDS

          Because you haven't specifed the jndi name for the
          resource manager in jboss.xml

          ejb-jar.xml
          <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


          <enterprise-beans>

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

          </enterprise-beans>

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


          • 2. Re: link -> java:/DefaultDS
            klyall

            Thanks for that, I have now got the "link ->" showing correctly.

            I have still not fixed my overall problem though as I think my JBoss/EJB config knowledge is not too good.

            I have an application with several CMP entity beans that I want to use the OracleDS.

            Therefore I have specified defaults in jbosscmp-jdbc.xml as:


            java:/OracleDS
            <datasource-mapping>Oracle8</datasource-mapping>
            <create-table>false</create-table>
            <remove-table>false</remove-table>


            I also have a resource manager in jboss.xml to map the JNDI name to resource name:

            <resource-managers>
            <resource-manager>
            <res-name>OracleDS</res-name>
            <res-jndi-name>java:OracleDS</res-jndi-name>
            </resource-manager>
            </resource-managers>

            Do I have to specify for each CMP Bean something in ejbjar.xml and/or in jbosscmp-jdbc.xml to link the CMP Bean to the specific datasource or is adding a resource-ref for each CMP Bean not required.

            I can't see where the application server makes the connection between a CMP Bean and its datasource.

            Thanks in advance for any help.

            • 3. Re: link -> java:/DefaultDS

              You do not need to configure a <resource-ref> if you have
              configured it in jbosscmp-jdbc.xml

              The <resource-ref> allows you to lookup("java:comp/env/jdbc/DataSoruce");

              Regards,
              Adrian

              • 4. Re: link -> java:/DefaultDS
                klyall

                Thanks again Adrian.

                I thought the resource-ref on the CMP Bean looked superfluous.

                In my application I have several CMP entity beans and all but one are accessing the OracleDS and one rogue CMP bean is accessing the DefaultDS.

                How does a CMP Beans know which datasource to use?

                I have looked at the jbosscmp-jdbc.xml and ejbjar.xml and can't see any differences between the CMP Bean definitions.

                Is there a way I can debug this problem?