Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Apache Tomcat »

RE: Resource in context.xml not found

Caldarale, Charles R

2006-12-10

Replies:

> From: pir8ped [mailto:john.pedersen@(protected)]
> Subject: Resource in context.xml not found
>
>  <!-- Define a database connection pool for MYSQL -->
>   <Resource name="starfriendMYSQL" auth="Container"

Try changing the above name attribute to "jdbc/starfriendMYSQL" and use
that name within your webapp code.

>    factory="org.apache.commons.dbcp.BasicDataSourceFactory"

Take out the above, since Tomcat's built-in factory is really:
  org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory

> The app doesn't initialise because it can't find the db
> resource.

What's the exact error message in the log?

Do you have something like the following in the WEB-INF/web.xml inside
the app:

<resource-ref>
   <description>DB Connection</description>
   <res-ref-name>jdbc/starfriendMYSQL</res-ref-name>
   <res-type>javax.sql.DataSource</res-type>
   <res-auth>Container</res-auth>
</resource-ref>

Not clear if you need it or not, but it shouldn't hurt, as long as it
doesn't conflict with the settings in the <Context> element.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@(protected)
To unsubscribe, e-mail: users-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.