tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Januski, Ken" <>
Subject Cannot get a DataSource
Date Fri, 20 Aug 2004 21:46:41 GMT
I've been beating my head against the wall on and off for a week now and
just can't seem to get the hand of JNDI DataSources with Tomcat. Everything
I try seems to end with "javax.naming.NamingException: Cannot create
resource instance."

Though I've also done a fair amount of research on this I haven't found any
clear answers as to what exactly causes this error, esp. when using Tomcat.

Thanks for any ideas,


The entries in server.xml, under <GlobalNamingResources> are:

<Resource name="jdbc/CheckUsers" auth="Container"
    <ResourceParams name="jdbc/CheckUsers">

In my web.xml I have:

And in the calling code I have:

private DataSource ds;
Context initContext;
Context env;

try {
	initContext = new InitialContext();
	env = (Context)initContext.lookup("java:comp/env");
	ds = (DataSource) env.lookup("jdbc/CheckUsers");
} catch ( NamingException ne ) { "Problem setting datasource in setDs using JNDI
and DataSource: " + ne + ".");
} catch ( Exception e ) { "Problem setting datasource in setDs : " + e + ".");

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message