1 Reply Latest reply on Aug 21, 2002 5:48 PM by Eric Van

    EJB Cannot find Data Source if Called by Remote Client First

    Eric Van Newbie

      First my version info
      jboss-3.0.0_tomcat-4.0.3
      tomcat-3.3.1 (for testing remote clients)
      all running on windows.

      Ok, here is the problem

      I have a simple stateless session bean that has one method which looks up a data source and then does a simple select.
      Now i have one jsp that does a jndi look up on that ejb and calls this method.
      I have placed the jsp on both the embeded tomcat server in jboss and on the external tomcat server (seperate vm).

      If i start jboss and call the embeded server page then it looks up the ejb just fine and the ejb is able to find the data source and complete successfully.
      Then if i call the external jsp everythings WORKS fine as well.

      So everything looks good, but if restart the server and hit that external page first, then the ejb cannot find
      the datasource!!! Also subsiquent calls to the embeded page begin to fail as well!!!!

      I cannot understand why the external jsp would be able to find the ejb and run the method, but that ejb will all of a sudden not be able to find the data source!!

      below are my jboss and ejb-jar files

      I hope someone has a solution for this cause it's driving me nutz!!

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

      <enterprise-beans>

      <ejb-name>ProductManager</ejb-name>
      <jndi-name>com.foo.product.ejb.ProductManager</jndi-name>
      <resource-ref>
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <jndi-name>java:/OracleDS</jndi-name>
      </resource-ref>

      </enterprise-beans>



      EJB-JAR.XML
      ----------------------

      <?xml version="1.0"?>

      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      <ejb-jar>
      <enterprise-beans>


      <ejb-name>ProductManager</ejb-name>
      com.foo.product.ejb.ProductManagerHome
      com.foo.product.ejb.ProductManager
      <ejb-class>com.foo.product.ejb.ProductManagerBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <resource-ref>
      <res-ref-name>jdbc/OracleDS</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>


      </enterprise-beans>
      </ejb-jar>