You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by le...@hccnet.nl on 2013/01/09 22:25:23 UTC

add database resource

I'm quite new with tomcat.
I run 7.0.30.

I have succesfully 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">
     <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" />
 </Context>

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.

Hopefully somebody knows what i'm doing wrong.

thanks in advance.

regards,

Léon



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


RE: add database resource

Posted by Martin Gainty <mg...@hotmail.com>.






<Realm className="org.apache.catalina.realm.JDBCRealm"
      driverName="org.gjt.mm.mysql.Driver"
   connectionURL="jdbc:mysql://localhost/authority?user=dbuser&amp;password=dbpass"
       userTable="users" userNameCol="user_name" userCredCol="user_pass"
   userRoleTable="user_roles" roleNameCol="role_name"/>



 not Resource..but  Realm http://tomcat.apache.org/tomcat-7.0-doc/realm-howto.html#JDBCRealm
for Hibernate:
specify the hibernate attributes in either hibernate.properties or hibernate.cfg.xml  (and place on classpath)

hibernate.connection.driver_classJDBC driver classhibernate.connection.urlJDBC URLhibernate.connection.usernamedatabase userhibernate.connection.passworddatabase user passwordhibernate.connection.pool_sizemaximum number of pooled connections
 configure each table in  /packagename/TableName.hbm.xml http://docs.jboss.org/hibernate/orm/3.3/reference/en/html/session-configuration.html
Bedankt,Martin-
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

 > Date: Wed, 9 Jan 2013 22:25:23 +0100
> Subject: add database resource
> From: leon.mail@hccnet.nl
> To: users@tomcat.apache.org
> 
> I'm quite new with tomcat.
> I run 7.0.30.
> 
> I have succesfully 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">
>      <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" />
>  </Context>
> 
> 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.
> 
> Hopefully somebody knows what i'm doing wrong.
> 
> thanks in advance.
> 
> regards,
> 
> Léon
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
 		 	   		  

Re: add database resource

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Leon,

On 1/10/13 2:37 PM, leon.mail@hccnet.nl wrote:
> I've changed it to this, but still no result...

I told you fixing this stuff wasn't going to fix your real problem.
It's just going to make your software run better in general.

> <Context>
> 
> <Resource name="jdbc/atvd12" auth="Container"
> type="javax.sql.DataSource" maxActive="100" maxIdle="30"
> maxWait="10000" username="root" password="" 
> driverClassName="com.mysql.jdbc.Driver" 
> url="jdbc:mysql://localhost:3306/atvd12"/>
> 
> </Context>

So, what about your Hibernate configuration?

- -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/

iEYEAREIAAYFAlDvSXIACgkQ9CaO5/Lv0PBUVACfQf3qyiD7QNf5qTYThZN9xwXA
jj4An3Q2F3hya7/l16NvUG2tfpu2J9Mj
=Mfkr
-----END PGP SIGNATURE-----

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


RE: add database resource

Posted by le...@hccnet.nl.
I've changed it to this, but still no result...

<Context>

  <Resource name="jdbc/atvd12" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="root" password=""
driverClassName="com.mysql.jdbc.Driver"
               url="jdbc:mysql://localhost:3306/atvd12"/>

</Context>

Op Do, 10 januari, 2013 8:34 pm schreef Caldarale, Charles R:
>> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
>> Subject: RE: add database resource
>>
>
>> attributes sandwiched between <Content></Content> XML tags
>
> Make that <Context></Context>...
>
>
> - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>



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


RE: add database resource

Posted by "Propes, Barry L " <ba...@citi.com>.
YES! Duh! Forgive me! LOL.

Context!!

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
Sent: Thursday, January 10, 2013 1:35 PM
To: Tomcat Users List
Subject: RE: add database resource

> From: Propes, Barry L [mailto:barry.l.propes@citi.com]
> Subject: RE: add database resource

> attributes sandwiched between <Content></Content> XML tags

Make that <Context></Context>...

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


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


RE: add database resource

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Propes, Barry L [mailto:barry.l.propes@citi.com] 
> Subject: RE: add database resource

> attributes sandwiched between <Content></Content> XML tags

Make that <Context></Context>...

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: add database resource

Posted by "Propes, Barry L " <ba...@citi.com>.
Right! Like Chuck says, Leon, that is invalid. Within the context file itself (context.xml) you need the Resource attributes sandwiched between <Content></Content>  XML tags and no other attributes in the context tag itself.

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com]
Sent: Thursday, January 10, 2013 12:47 PM
To: Tomcat Users List
Subject: RE: add database resource

> From: leon.mail@hccnet.nl [mailto:leon.mail@hccnet.nl]
> Subject: RE: add database resource


> Herewith the content of META-INF/context.xml

> <Context="/atvd">

Well, that's invalid right off the bat, so the rest of it probably doesn't matter.  Read the <Context> doc again.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


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


RE: add database resource

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: leon.mail@hccnet.nl [mailto:leon.mail@hccnet.nl] 
> Subject: RE: add database resource


> Herewith the content of META-INF/context.xml

> <Context="/atvd">

Well, that's invalid right off the bat, so the rest of it probably doesn't matter.  Read the <Context> doc again.

 - 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 unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: add database resource

Posted by le...@hccnet.nl.
Hi,

Herewith the content of META-INF/context.xml

<Context="/atvd">
		  <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" />
		</Context>

Regards,

Léon

Op Do, 10 januari, 2013 7:10 pm schreef Propes, Barry L:
> Did you remove the contents from the server.xml? Or just paste the same
> contents to the META-INF/context.xml file?
>
> You might want to add the contents of the context.xml file to the thread
> message.
>
> -----Original Message-----
> From: Leon [mailto:leon.mail@hccnet.nl]
> Sent: Thursday, January 10, 2013 11:53 AM
> To: Tomcat Users List
> Subject: Re: add database resource
>
>
> Unfortunately still same error
>
>
> Regards,
>
>
> Léon
>
>
> Op 10 jan. 2013 om 04:29 heeft Christopher Schultz
> <ch...@christopherschultz.net> het volgende geschreven:
>
>
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA256
>>
>>
>> Leon,
>>
>>
>> On 1/9/13 5:37 PM, leon.mail@hccnet.nl wrote:
>>
>>> Op Wo, 9 januari, 2013 10:37 pm schreef Christopher Schultz: Tried to
>>>  creat a context.xml in META-INF/context.xml, however, not sure about
>>>  the full conten.
>>>
>>> Are you able to provide met a contect.xml with example code, where i
>>> can adjust variables? ould help a lot!
>>
>> Just take your <Context> element out of server.xml and put the whole
>> thing into META-INF/context.xml.
>>
>>>> I know nothing about Hibernate, but you may have to post your
>>>> Hibernate configuration in order to get any further, here.
>>>>
>>>
>>> If needed not a problem, but hopefully a correct context.xml will do
>>>
>>
>> A proper context.xml is unlikely to have any bearing on your problem.
>> I'm just trying to get other noise out of the way.
>>
>>
>> - -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/
>>
>>
>> iEYEAREIAAYFAlDuNZoACgkQ9CaO5/Lv0PBuQQCgiTgdJbzjtiJDKf8mIV/N7fo1
>> Pj4AnjBp/2ZhkzFNUHjlcoF+gO+B+7cJ
>> =i+2h
>> -----END PGP SIGNATURE-----
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>



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


RE: add database resource

Posted by "Propes, Barry L " <ba...@citi.com>.
Did you remove the contents from the server.xml? Or just paste the same contents to the META-INF/context.xml file?

You might want to add the contents of the context.xml file to the thread message.

-----Original Message-----
From: Leon [mailto:leon.mail@hccnet.nl]
Sent: Thursday, January 10, 2013 11:53 AM
To: Tomcat Users List
Subject: Re: add database resource

Unfortunately still same error

Regards,

Léon

Op 10 jan. 2013 om 04:29 heeft Christopher Schultz <ch...@christopherschultz.net> het volgende geschreven:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Leon,
>
> On 1/9/13 5:37 PM, leon.mail@hccnet.nl wrote:
>> Op Wo, 9 januari, 2013 10:37 pm schreef Christopher Schultz: Tried to
>> creat a context.xml in META-INF/context.xml, however, not sure about
>> the full conten.
>>
>> Are you able to provide met a contect.xml with example code, where i
>> can adjust variables? ould help a lot!
>
> Just take your <Context> element out of server.xml and put the whole
> thing into META-INF/context.xml.
>
>>> I know nothing about Hibernate, but you may have to post your
>>> Hibernate configuration in order to get any further, here.
>>
>> If needed not a problem, but hopefully a correct context.xml will do
>
> A proper context.xml is unlikely to have any bearing on your problem.
> I'm just trying to get other noise out of the way.
>
> - -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/
>
> iEYEAREIAAYFAlDuNZoACgkQ9CaO5/Lv0PBuQQCgiTgdJbzjtiJDKf8mIV/N7fo1
> Pj4AnjBp/2ZhkzFNUHjlcoF+gO+B+7cJ
> =i+2h
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>

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


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


Re: add database resource

Posted by Leon <le...@hccnet.nl>.
Unfortunately still same error

Regards,

Léon

Op 10 jan. 2013 om 04:29 heeft Christopher Schultz <ch...@christopherschultz.net> het volgende geschreven:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> Leon,
> 
> On 1/9/13 5:37 PM, leon.mail@hccnet.nl wrote:
>> Op Wo, 9 januari, 2013 10:37 pm schreef Christopher Schultz: Tried
>> to creat a context.xml in META-INF/context.xml, however, not sure 
>> about the full conten.
>> 
>> Are you able to provide met a contect.xml with example code, where
>> i can adjust variables? ould help a lot!
> 
> Just take your <Context> element out of server.xml and put the whole
> thing into META-INF/context.xml.
> 
>>> I know nothing about Hibernate, but you may have to post your 
>>> Hibernate configuration in order to get any further, here.
>> 
>> If needed not a problem, but hopefully a correct context.xml will
>> do
> 
> A proper context.xml is unlikely to have any bearing on your problem.
> I'm just trying to get other noise out of the way.
> 
> - -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/
> 
> iEYEAREIAAYFAlDuNZoACgkQ9CaO5/Lv0PBuQQCgiTgdJbzjtiJDKf8mIV/N7fo1
> Pj4AnjBp/2ZhkzFNUHjlcoF+gO+B+7cJ
> =i+2h
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 

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


Re: add database resource

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Leon,

On 1/9/13 5:37 PM, leon.mail@hccnet.nl wrote:
> Op Wo, 9 januari, 2013 10:37 pm schreef Christopher Schultz: Tried
> to creat a context.xml in META-INF/context.xml, however, not sure 
> about the full conten.
> 
> Are you able to provide met a contect.xml with example code, where
> i can adjust variables? ould help a lot!

Just take your <Context> element out of server.xml and put the whole
thing into META-INF/context.xml.

>> I know nothing about Hibernate, but you may have to post your 
>> Hibernate configuration in order to get any further, here.
> 
> If needed not a problem, but hopefully a correct context.xml will
> do

A proper context.xml is unlikely to have any bearing on your problem.
I'm just trying to get other noise out of the way.

- -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/

iEYEAREIAAYFAlDuNZoACgkQ9CaO5/Lv0PBuQQCgiTgdJbzjtiJDKf8mIV/N7fo1
Pj4AnjBp/2ZhkzFNUHjlcoF+gO+B+7cJ
=i+2h
-----END PGP SIGNATURE-----

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


Re: add database resource

Posted by le...@hccnet.nl.
Chris,

Tx for your reply
Op Wo, 9 januari, 2013 10:37 pm schreef Christopher Schultz:
> -----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.
>
Sure I Will

>> 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.

That's possible, got the instruction from a friend.
So it indeed was in my server.xml.

Tried to creat a context.xml in META-INF/context.xml, however, not sure
about the full conten.

Are you able to provide met a contect.xml with example code, where i can
adjust variables? ould help a lot!
>
> Do you really need "crossContext", "antiJARLocking", and
> "antiResourceLocking" attributes?
>
No, so can leave it.

>> <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(Dispa
>> tcherUtils.java:196)
>>
>>
>>
> com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispa
> tcher.java:182)
>
>>
>>
>>
>> root cause java.lang.NullPointerException
>> nl.dolhuis.util.hibernate.HibernateSession.getSession(HibernateSession.
>> java:25)
>>
>>
>>
> nl.dolhuis.util.hibernate.HibernateInterceptor.intercept(HibernateInterce
> ptor.java:83)
>
>> com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvo
>> cation.java:180)
>>
>>
>>
> com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundInte
> rceptor.java:32)
>
>> com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionInvo
>> cation.java:180)
>>
>>
>>
> com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.java
> :119)
>
>> com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(Dispa
>> tcherUtils.java:183)
>>
>>
>>
> com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDispa
> tcher.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?

Just the same stack trace.
>
> I know nothing about Hibernate, but you may have to post your
> Hibernate configuration in order to get any further, here.
>
If needed not a problem, but hopefully a correct context.xml will do
>
> - -chris

thanks in advance for your help, much appreciated.

Regards,

Léon
> -----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
>
>
>



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


Re: add database resource

Posted by le...@hccnet.nl.
Op Wo, 9 januari, 2013 11:48 pm schreef Mark Eggers:
> On 1/9/2013 1:37 PM, Christopher Schultz wrote:
>
>> -----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(Dis
>>> patcherUtils.java:196)
>>>
>>>
>>>
>> com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDis
>> patcher.java:182)
>>
>>>
>>>
>>>
>>> root cause java.lang.NullPointerException
>>> nl.dolhuis.util.hibernate.HibernateSession.getSession(HibernateSessio
>>> n.java:25)
>>>
>>>
>>>
>> nl.dolhuis.util.hibernate.HibernateInterceptor.intercept(HibernateInter
>> ceptor.java:83)
>>
>>> com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionIn
>>> vocation.java:180)
>>>
>>>
>>>
>> com.opensymphony.xwork.interceptor.AroundInterceptor.intercept(AroundIn
>> terceptor.java:32)
>>
>>> com.opensymphony.xwork.DefaultActionInvocation.invoke(DefaultActionIn
>>> vocation.java:180)
>>>
>>>
>>>
>> com.opensymphony.xwork.DefaultActionProxy.execute(DefaultActionProxy.ja
>> va:119)
>>
>>> com.opensymphony.webwork.dispatcher.DispatcherUtils.serviceAction(Dis
>>> patcherUtils.java:183)
>>>
>>>
>>>
>> com.opensymphony.webwork.dispatcher.FilterDispatcher.doFilter(FilterDis
>> patcher.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
>>
>
> Leon,
>
>
> Looks like you're using Hibernate.
>
>
> Try the following in your hibernate.cfg.xml file:
>
>
> <!-- using container-managed JNDI -->
> <property name="hibernate.connection.datasource">
> java:comp/env/jdbc/atvd
> </property>
>
>
> You'll still need the database dialect properties; in other words:
>
>
> <property name="hibernate.dialect">
> org.hibernate.dialect.MySQLDialect </property>
>
>
> You won't need any of the other connection properties in
> hibernate.cfg.xml
>
> I wrote up a Wiki page on the Tomcat site, but it really needs an update.
>
>
> 1. Uses path in context.xml (NetBeans-ism)
> 2. Doesn't use best practices in setting maxIdle and maxActive
> 3. Doesn't use a validationQuery
> 4. Doesn't use removeAbandoned
> 5. Doesn't use logAbandoned
>
>
> With a now-ancient version of Hibernate / Tomcat / Java / OS
>
>
> Hibernate 3.2.5ga
> Tomcat 6.0.26
> JRE 1.6.0_20 (32 bit)
> OS Fedora 11 (32 bit)
>
>
> However, that may be enough to get you started.
>
>
> I'll hopefully take a look at it sometime soon.
>
>
> . . . . just my two cents.
> /mde/
>
Hi Chris,

Tx for your reply.
I've added the two properte names to the hibernate.cfg.xml., within the
webapp.
I didn't write the app, somebody else did.

So where do you recommend to add the database name, user and password.
in server.xml or context.xml witin META-INF?

Regards,

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



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


Re: add database resource

Posted by Mark Eggers <it...@yahoo.com>.
On 1/9/2013 1:37 PM, Christopher Schultz wrote:
> -----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

Leon,

Looks like you're using Hibernate.

Try the following in your hibernate.cfg.xml file:

<!-- using container-managed JNDI -->
<property name="hibernate.connection.datasource">
           java:comp/env/jdbc/atvd
</property>

You'll still need the database dialect properties; in other words:

<property name="hibernate.dialect">
           org.hibernate.dialect.MySQLDialect
</property>

You won't need any of the other connection properties in hibernate.cfg.xml

I wrote up a Wiki page on the Tomcat site, but it really needs an update.

1. Uses path in context.xml (NetBeans-ism)
2. Doesn't use best practices in setting maxIdle and maxActive
3. Doesn't use a validationQuery
4. Doesn't use removeAbandoned
5. Doesn't use logAbandoned

With a now-ancient version of Hibernate / Tomcat / Java / OS

Hibernate 3.2.5ga
Tomcat 6.0.26
JRE 1.6.0_20 (32 bit)
OS Fedora 11 (32 bit)

However, that may be enough to get you started.

I'll hopefully take a look at it sometime soon.

. . . . just my two cents.
/mde/

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


Re: add database resource

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----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