tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: add database resource
Date Wed, 09 Jan 2013 21:37:12 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Leon,

On 1/9/13 4:25 PM, leon.mail@hccnet.nl 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(DispatcherUtils.java:196)
>
> 
com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:182)
> 
> 
> 
> root cause java.lang.NullPointerException 
> nl.dolhuis.util.hibernate.HibernateSession.getSession(HibernateSession.java:25)
>
> 
nl.dolhuis.util.hibernate.HibernateInterceptor.intercept(HibernateInterceptor.java:83)
> com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
>
> 
com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInterceptor.java:32)
> com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvocation.java:180)
>
> 
com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java:119)
> com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(DispatcherUtils.java:183)
>
> 
com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:182)
> 
> 
> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEAREIAAYFAlDt4wgACgkQ9CaO5/Lv0PDqAACcCU37VTsGS2C5EBRHLQ7nJPfk
YtkAn1Xf0zaWueMWx48a5Yh6VF+nciCk
=kpR3
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message