3 Replies Latest reply on Jun 18, 2004 12:30 PM by nuser

    deployed EJB's on wrong datasource

    u9707118 Newbie

      I am so close, I can smell it!

      I have installed a datasource for oracle9i by adapting the oracle-ds.xml file in the examples/jca directory.
      I deploy my EJB jar file in the deployment directory - which unpacks and installs fine. I even get my client java app to communicate with my EJB's on the server.

      The only problem I have is that my EJB's are not bound to my oracle database - I guess they are probably bound to the default Hypersonic database?
      ...So I can read/write to the DB no problem (through the EJB's) but it is the wrong database.

      I must have missed something somewhere?
      The JNDi relevant parts of my deployment descriptors are below:

      ejb-jar.xml:

      <ejb-jar>
      <resource-ref>
       <res-ref-name>jdbc/OracleDS</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
      ...etc
      </ejb-jar>
      


      jboss.xml:
      <jboss>
      <resource-ref>
       <res-ref-name>jdbc/OracleDS</res-ref-name>
       <jndi-name>java:/OracleDS</jndi-name>
      </resource-ref>
      ...etc
      </jboss>
      


      What could I be missing?

        • 1. Re: deployed EJB's on wrong datasource
          Kabir Khan Master

          You need a jbosscmp-jdbc.xml file as well. Thet's where you define what datasource to use for your entities and perform field/relationship mapping

          • 2. Re: deployed EJB's on wrong datasource
            u9707118 Newbie

            Thank you very much, my friend.
            That was exactly what I was missing.

            My fingers are hurting, but at last I now have it working.
            Thanks for the tip!

            • 3. Re: deployed EJB's on wrong datasource
              nuser Newbie

              Hi there!

              I think the problem is solved. In fact, I was thinking of starting a new thread for my problem but as it is quite related to this thread and so, I am "extending" this thread!
              Sorry for any inconvenience and thanks!!

              PROBLEM : I am deploying a .war file onto JBoss 3.2.3. Previously I had this .war file working fine on Tomcat.
              What changes should I make to make my .war working here. I have very basic knowlege of JBoss.

              WHAT I DID :
              1. Copied the .war under default/deployed.
              2. To use Oracle, copied Oracle-ds.xml from examples/jca and modified. Now it looks like --

              <datasources>
               <local-tx-datasource>
               <jndi-name>DefaultDS</jndi-name>
               <connection-url>jdbc:oracle:oci:@ABC</connection-url>
               <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
               <user-name>username</user-name>
               <password>password</password>
               <min-pool-size>5</min-pool-size>
               <max-pool-size>20</max-pool-size>
               </local-tx-datasource>
              </datasources>
              


              What other changes am I supposed to make and in which Files?

              Can anybody guide please?

              Thanks for all your help!
              By The Way -- Is there any relationship between the JNDI name and name of the file?