[jboss-user] [Installation, Configuration & DEPLOYMENT] - Datasource Lookup Problem
ruewan
do-not-reply at jboss.com
Thu Jul 10 09:57:36 EDT 2008
I am trying to deploy an application that has predefined datasource names
I added a jboss-web.xml to the web-inf folder with these contents
<jboss-web>
<resource-ref>
<res-ref-name>jdbc/blah</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<jndi-name>java:blah</jndi-name>
</resource-ref>
</jboss-web>
The web.xml has the following resource ref
<resource-ref>
jdbc/blah Connection
<res-ref-name>blah</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<%
javax.naming.InitialContext ctxt = new javax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctxt.lookup("jdbc/blah");
java.sql.Connection conn = ds.getConnection();
%>
<%=conn%>
<%conn.close();%>
when i run the app i get the following exception
javax.servlet.ServletException: javax.naming.NameNotFoundException: jdbc not bound
if i change the look up from ctxt.lookup("jdbc/blah"); to ctxt.lookup("java:jdbc/blah"); it works.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4163619#4163619
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4163619
More information about the jboss-user
mailing list