Re: JPA/Hibernate persistence and MySQL connection timeout

2008-12-30 Thread tarakarajendra prasad
Hello Kees De Kooter,

   Please Mention the query and hibernate.cfg.xml properties, you have given
so that we can know little more better the error.
 wishes,
Prasad DTR


- Original Message 
From: Kees de Kooter kdekoo...@gmail.com
To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, 29 December, 2008 20:50:05
Subject: Re: JPA/Hibernate persistence and MySQL connection timeout

Hi Ken,

Take a look at this page:
http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/configuration.html
As you can see the datasource is obtained using JNDI:
jta-data-sourcejava:/DefaultDS/jta-data-source


Cheers,
Kees de Kooter
http://www.boplicity.net



On Mon, Dec 29, 2008 at 14:41, Ken Bowen kbo...@als.com wrote:
 Kees,

 Can you point me to a discussion of how to do that?

 Thanks,
 Ken

 On Dec 29, 2008, at 3:42 AM, Kees de Kooter wrote:

 Why don't u use the existing datasources for JPA (instead of setting
 the hibernate.connection properties)?

 Kees


 On Mon, Dec 29, 2008 at 00:50, Ken Bowen kbo...@als.com wrote:

 Hi All,

 I'm using: Tomcat 6.0.18; Mysql 5.0.51a; Java 1.5; Hibernate 3.2;  (no
 spring)

 MyApp utilizes five (5) distinct mysql catalogs (databases).
 Originally all 5 were accessed using JDBC/JNDI with Resources that all
 look
 like this
 (in webapps/MyApp/META-INF):

 Resource name=jdbc/CATALOGNAME auth=Container
 type=javax.sql.DataSource
  maxActive=100 maxIdle=30 maxWait=1
  username=X password=X
  driverClassName=com.mysql.jdbc.Driver
  url=jdbc:mysql://localhost:3306/CATALOGNAME
  validationQuery=select 1
 /

 Everything worked fine, including the validationQuery to deal with MySQL
 closing connections overnight.

 Recently I replaced the JDBC access for 3 of the catalogs by use of
 JPA/Hibernate persistence,
 while leaving the other two catalogs as originally implemented (they
 consist
 of large tables
 containing daily price information; hence not very object-oriented.) The
 persistence.xml looks
 like this:

 persistence-unit name=ctdbPU transaction-type=RESOURCE_LOCAL
  providerorg.hibernate.ejb.HibernatePersistence/provider

  . lots of class entries like:
  classcom.connectedtrading.database.users.AbstractLineitem/class
  classcom.connectedtrading.database.users.Lineitem/class

  properties
property name=hibernate.connection.driver_class
 value=com.mysql.jdbc.Driver /
property name=hibernate.connection.url
 value=jdbc:mysql://localhost:3306/CATALOGNAME /
property name=hibernate.connection.username value=X /
property name=hibernate.connection.password value=X /
  /properties
 /persistence-unit

 [Interestingly enough, only one of the 3 CATALOGNAMEs appears.]
 Note that I left all 5 of the Resource elements in place in context.xml.

 Once again, everything works well, EXCEPT that now when I leave the
 system
 running overnight and
 no accesses occur (it's only in dev mode), in the morning I now get the
 exception shown at the
 end of this email.  It certainly looks like the mysql disconnect
 behavior.
 As with the JDBC case, repeating the access causes everything to start
 working correctly.
 The query being submitted is

  org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)


 com.connectedtrading.database.users.UserDAO.findByProperty(UserDAO.java:180)

 com.connectedtrading.database.users.UserDAO.findByLogin(UserDAO.java:203)

 which is a hibernate query supporting user login.

 If anyone on the list has had experience with this issue under
 JPA/Hibernate
 persistence,
 I hope you can give me some pointers to dealing with it.

 Thanks much in advance,
 Ken Bowen

 - The Exception-

 HTTP Status 500 -

 type Exception report

 message

 description The server encountered an internal error () that prevented it
 from fulfilling this request.

 exception

 javax.servlet.ServletException: javax.persistence.PersistenceException:
 org.hibernate.exception.JDBCConnectionException: could not execute query


 org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:523)


 org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)


 org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)

 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)

  org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 root cause

 javax.persistence.PersistenceException:
 org.hibernate.exception.JDBCConnectionException: could not execute query


 org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630)
  org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:75)


 com.connectedtrading.database.users.UserDAO.findByProperty(UserDAO.java:180)

 

Re: Questions about Tomcat installation on Solaris Platform

2007-02-08 Thread tarakarajendra prasad
hello ravi,
in server.xml , in your context give
 Context  path=/...  docBase=...  ..
 Resource name=jdbc/myOracle auth=Container type=javax.sql.DataSource
   maxActive=100 maxIdle=30 maxWait=1
   username=scott password=tiger 
driverClassName=oracle.jdbc.driver.OracleDriver
   url=jdbc:oracle:thin:@localhost:1521:ora10  /
Context
 drop ojdbc14.jar in CATALINA_HOME's common\lib directory
you can access through JAVA ENC easily
 wishes,
 Prasad DTR 
  

- Original Message 
From: Chittajalu, Ravi S. [EMAIL PROTECTED]
To: users@tomcat.apache.org
Sent: Tuesday, 6 February, 2007 10:20:51 PM
Subject: Questions about Tomcat installation on Solaris Platform


Hello Users Group, 

Request your help on following questions

1. This one is more a clarification question. 
I used a Unix account 'devuser', which is not
associated to any Unix group. I installed Tomcat
using this user account. I was able to
successfully install and Tomcat runs fine. With
the same user I am not able to execute any Java
program. I get an
Exception in thread main
java.lang.NoClassDefFoundError: TestDB . The program
compiles well, but cannot execute. My question is how is
Tomcat able to Run under the same User account 'devuser'??

2. I configured a Database resource name with JNDI name
jdbc/oracle10g, but I do not have a way to test and it
does not look like the connection is happening.
I gave the 
 URL :jdbc:oracle:oci:@host:port:SID
Driver as: oracle.jdbc.driver.OracleDriver
Then userid / password.

I tested the SID from unix command line using
SQLPLUS and it works.
Can some suggest a way to test this and If there
is any problem with the configuration.

Regards
Ravi Chittajalu


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



___ 
What kind of emailer are you? Find out today - get a free analysis of your 
email personality. Take the quiz at the Yahoo! Mail Championship. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



context

2007-01-10 Thread tarakarajendra prasad
hello sir,

   Please tell me how to create context under host from administration tool af=
ter editing tomcat-users.xml and logging as adminmanager.

   regards,
  Prasad DTR



___ 
All New Yahoo! Mail – Tired of unwanted email come-ons? Let our SpamGuard 
protect you. http://uk.docs.yahoo.com/nowyoucan.html

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]