tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: add database resource
Date Wed, 09 Jan 2013 21:37:12 GMT
Hash: SHA256


On 1/9/13 4:25 PM, wrote:
> I'm quite new with tomcat. I run 7.0.30.

Welcome. 7.0.35 will likely be released shortly. Please upgrade when
you can.

> I have successfully installed an application, however i'm facing
> issues with the database connection.
> As i understood i added the following code to server.xml
> <Context path="/" debug="1" reloadable="true" crossContext="true" 
> antiJARLocking="true" antiResourceLocking="true">

You may be following old instructions: you shouldn't use the "path"
attribute in a <Context> element unless it's in your server.xml file
(which is should not be: you should be META-INF/context.xml in your
webapp's base directory instead). Also, the "debug" attribute has not
been valid for quite some time.

Do you really need "crossContext", "antiJARLocking", and
"antiResourceLocking" attributes?

> <Resource name="jdbc/atvd" type="javax.sql.DataSource" 
> auth="container" username="atvd" password="atvd" 
> driverClassName="com.mysql.jdbc.Driver" 
> url="jdbc:mysql://localhost:3306/atvd12?autoReconnect=true" />

This looks okay to me, though it's typical to set the "maxActive" and
"maxIdle" attributes here to size your connection pool. The defaults
are maxActive=8 and maxIdle=8 FYI.

In development, I *highly* recommend that you set maxActive=1.

I usually recommend adding a "validationQuery" plus "removeAbandoned",
"logAbandoned", and set a reasonable "removeAbandonedTimeout" (I use
"30" to specify a 30-second timeout). A good validationQuery for MySQL
is "/* ping */ SELECT 1" because the driver will use a lightweight
ping instead of actually issuing a SQL query to the server: it reduces
some useless overhead.

> Unfortunately I'm Getting below error. Don't get any special
> information from the log.
> type Exception report
> message Could not execute action
> description The server encountered an internal error that prevented
> it from fulfilling this request.
> exception javax.servlet.ServletException: Could not execute action 
> com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(
> root cause java.lang.NullPointerException 
> nl.dolhuis.util.hibernate.HibernateSession.getSession(
> com.opensymphony.xwork.DefaultActionInvocation.invoke(
> com.opensymphony.xwork.DefaultActionInvocation.invoke(
> com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(
> note The full stack trace of the root cause is available in the
> Apache Tomcat/7.0.30 logs.

Have you checked logs/catalina.out or anything else in logs/? You said
there was no special information... does it just have the same stack
trace or is there nothing?

I know nothing about Hibernate, but you may have to post your
Hibernate configuration in order to get any further, here.

- -chris
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools -
Comment: Using GnuPG with undefined -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message