• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Troubleshooting Datasources In Tomcat 6

 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to run a web application that was designed for Jboss on Tomcat, and I'm having trouble with the database connection. Any help you can give me would be greatly appreciated!

After deploying the application, I created a datasource. I then executed the servlet that tests the "health" of the web app, including the database. When I run that servlet, I get an error stating that it can't connect to the database.

Here's the line of code that's failing:

Here's the error message that I get in /var/log/tomcat6/catalina.out:

And here's my data source config within /etc/tomcat6/context.xml

The problem is that I can't determine if the problem is in the code or in the data source configuration, and I don't know how to debug this.

Here's what I do know:

1. The db is running
2. I can query it using the mysql-client.
3. I can telnet to port 3306 on my machine
4. The servlet works perfectly well on Jboss on someone else's machine
5. I have restarted Tomcat multiple times, and the problem hasn't changed.

So here's my questions:

1. Is there a tool I can use to test Tomcat datasources?
2. Which log level do I need to dial up if I want to get more verbose JDBC error messagess?

Thanks in advance!

Tom Purl
 
author & internet detective
Posts: 40747
827
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tom,
Are you sure java:MyDataSource is the name of your datasource? Usually the reference is java:comp/env/jdbc/MyDataSource.

Since your question is largely about troubleshooting Tomcat configuration, I'm going to move it to our Tomcat forum.
 
Tom Purl
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Jeanne! Here's what ended up working:


Thanks again!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic