2 Replies Latest reply on May 7, 2005 9:01 AM by anguyen

    jndi lookup of datasource: broken in jboss 4.x?

    eqe99

      doesnt work for me & i fail to see the error here.

      jboss-4.0.1sp1
      winxp
      jdk 1.4.x

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

      jboss-web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
       <resource-ref>
       <res-ref-name>jdbc/dev</res-ref-name>
       <jndi-name>java:dev</jndi-name>
       </resource-ref>
      </jboss-web>
      


      mssql-ds.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <datasources>
       <local-tx-datasource>
       <jndi-name>dev</jndi-name>
       <use-java-context>true</use-java-context>
       <connection-url>...</connection-url>
       <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
       <user-name>sa</user-name>
       <password></password>
       <min-pool-size>5</min-pool-size>
       <max-pool-size>20</max-pool-size>
       <idle-timeout-minutes>0</idle-timeout-minutes>
       </local-tx-datasource>
      </datasources>
      


      web.xml
       <resource-ref>
       <description>The default DS</description>
       <res-ref-name>jdbc/dev</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
      


      java code
      Context initCtx = new InitialContext();
      Context envCtx = (Context) initCtx.lookup("java:comp/env");
      DataSource ds = (DataSource) envCtx.lookup("jdbc/dev);
      conn = ds.getConnection();
      



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

      im sure it would work if i did the lookup the jboss way, but this should really be portable across containers (the java code does work in tomcat 5.x).

      yes, i can see the mbean & ive tried all sorts of ways to get this to work, so if anyone knows the answer to this, please let me know.


      i like jboss but this is just stupid--maybe im missing something, but it shouldn't be this much of a hassle. judging by the number of posts on this subject & the jca moderator's comments, it appears that im not the only one having this problem.