0 Replies Latest reply on Aug 29, 2005 3:02 PM by Matt Owen

    JNDI JDBC Datasource question

    Matt Owen Newbie

       

      I am having trouble getting my JDBC Datasource working properly and I was wondering if you might be able to assist. I'm sure it's something simple I'm missing.
      
      
      Here are the specifics.
      
      This is my entry in my web.xml:
      
      
       <resource-ref>
       <description>DB Connection</description>
       <res-ref-name>jdbc/SSOPool</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       </resource-ref>
      
      
      Here is my jboss-web.xml
      
      
      
       <jboss-web>
       <resource-ref>
       <res-ref-name>jdbc/SSOPool</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <jndi-name>java:/SSOPool</jndi-name>
       </resource-ref>
       </jboss-web>
      
      
      I have taken this verbatum out of the JBOSS AS guide example 3.10 and 3.12, simply replacing DefaultDS with SSOPool
      
      Question #1) Was this legal or is there something special about DefaultDS and I need to do that to SSOPool, my own ref name?
      
      
      When I ran the application, I get the following from the tomcat 55 log:
      
      
      >>>>>>>>>> getDataSourceName(): 'java:comp/env/jdbc/SSOPool'
      
       13:43:31,617 INFO [STDOUT] >>>>>>>>>> jndi: 'java:comp/env/jdbc/SSOPool'
       13:43:31,620 ERROR [BaseFilter] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: SSOPool not bound]
      
      
      
      Here is the code that generated the above debug output and ERROR:
      
      
       try {
       String jndi = ServiceLocator.getDataSourceName( "SSOPool" );
       System.out.println(">>>>>>>>>> jndi: '" + jndi + "'");
      
       DataSource dataSource = ServiceLocator.getInstance().getDataSource( jndi );
       System.out.println(">>>>>>>>>> got DataSource!"); <--- never gets to this line
      
       return dataSource.getConnection();
       } catch ( Exception e ) {
       <---- this exception is caught! ----->
       log.error( e );
       }
       return connection;
      
      
       public static String getDataSourceName( String name ) {
       System.out.println("\n>>>>>>>>>> getDataSourceName(): '" + "java:comp/env/jdbc/" + name + "'\n");
       return "java:comp/env/jdbc/" + name;
       }
      
      
      Question #2) Am I doing something wrong here and if so, what do I need to change?
      
      Thanks in advance for any assistance.
      
      If you could please copy and response posted here to mlenkeit@smartonline.com it would be greatly appreciated.
      
      
      
      >
      >