tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Hart <>
Subject Re: NamingException: Cannot create resource instance
Date Thu, 07 Sep 2006 20:22:22 GMT
The attachments in my previous message got mangled.  Sorry, I'm a newbie. 
Here is the relevant portion of the server.xml file (the formatting in this
will probably get mangled too):

<Resource name="jdbc/WroxTC5" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/WroxTC5">


And here is the relevant portion of the web.xml file:


The code in the jsp that generates the exception is line 14 of the following

11: <%
12: InitialContext initCtx = new InitialContext();
13: if( initCtx != null ) {
14:    DataSource ds = (DataSource)
15:    Connection conn = ds.getConnection();
16:    Statement stmt = conn.createStatement();
17:    ResultSet rset = stmt.executeQuery("select * from employee;");

As you can see, I'm just trying to get an example working.

Thanks again for any help,

Quoting Kevin Hart <>:

> Hello,
> I'm trying to get a jsp to access a mysql database.  I'm using the
> "preferred" JNDI resources approach with Tomcat, but I keep getting the
> NamingException: Cannot create resource instance error.  I know others
> have posted with this error.  I've read some of those posts, but
> the solutions don't seem to fix the problem in my case.
> I'm using FC5, MySql 5.0.22 and Apache Tomcat 5.5.15.  I attach the
> following files:
> is a copy of the html page showing the error.
> common.lib.contents is the output of a script session to show the
> contents of my /usr/share/tomcat5/common/lib directory.  I have at least
> the
> following in there: mysql-connector-java-5.0.3-bin.jar, commons-pool.jar,
> common-collections.jar, naming-factory.jar and naming-resources.jar.
> server.xml is my /usr/share/tomcat5/conf/server.xml file.  I have a
> <Resource> tag inside a <DefaultContext> tag inside the <host> element
> (see the end of the file).
> web.xml is from the jsp-examples/WEB-INF directory.  (I'm just tacking
> my jdbctest.jsp onto the existing jsp-examples webapp.)  The
> <resource-ref> tag is at the end of that file.
> Having no experience with Tomcat, I'm basically following instructions
> from Wrox's book "Professional Apache Tomcat 5."  I must be misreading
> it.
> Thanks in advance,
> Kevin

To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message