Meaningless Drivel is fun!*
The moose likes Tomcat and the fly likes One of the resources defined in context.xml not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "One of the resources defined in context.xml not working " Watch "One of the resources defined in context.xml not working " New topic
Author

One of the resources defined in context.xml not working

Ben Zung
Ranch Hand

Joined: Mar 25, 2004
Posts: 109
Hi ranchers, I have this problme that I could no figure out. Any help is appreciated. Following are part of the context.xml file for my application, which needs to make connections to any of them depending on user's selection.

The problme is, the application can obtain connections to db1, db2, db4 but never db3. The error message was "Name db3 is not bound in this Context".
The way the application obtains connection is:

(dbName is either db1,db2,db3 or db4 and lowercased before being looked up)

And all the four databases are hosted by the same sql server. I checked there wasn't a typo or anything.

Thanks in adavance for your help.

Ben
[ July 01, 2008: Message edited by: Ben Zung ]
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
I don't know the answer but throw some ideas to pinpoint the problem. Have you tried to move the DB3 definition to first in the list? Have you tried to rename the connection something other than DB3? Have you tired to rename the database to something other than DB3? (the last two just in case the word DB3 is reserved by tomcat or some other entity in the callstack)
Ben Zung
Ranch Hand

Joined: Mar 25, 2004
Posts: 109
Thanks for the reply.
No I did not move it to the first in the list but doubt that would make a difference.
And yes I have tried to rename it to something else and still broke. The name in the source is actually something else, I posted as "db3" for the purpose of asking the question. The real source name is "abdominaltrauma" and it is hard to imagine it is reserved anywhere.

Thanks you for looking at the problem.

Ben
Ilari Moilanen
Ranch Hand

Joined: Apr 15, 2008
Posts: 198
no problem.
BTW you are missing the < before the third resource there...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: One of the resources defined in context.xml not working
 
Similar Threads
Error confguring multiple contexts/data sources in Tomcat 5
Cant connect to SQL server with jtds 1.2.2
Cannot get a connection, pool error Timeout waiting for idle object
Commons DBCP with socketTimeout JTDS driver
Tomcat 5.5.9 admin and Datasources