|
Re: Need to figure out how to properly configure EclipseLink [message #634209 is a reply to message #634184] |
Wed, 20 October 2010 19:15 |
Tom Eugelink Messages: 825 Registered: July 2009 |
Senior Member |
|
|
We have problems with MySQL and Eclipselink on TC6. Maybe your problem has the same cause.
For some reason inactive connection are made invalid by MySql and Eclipselink does not do a good validation that detects this before using these connection again. You then get all kind of errors until these connections are cleared from the pool. Currently we're trying to replace the connection pool with a different implementation.
Tom
On 20-10-2010 19:27, Patricia Goldweic wrote:
> I need to understand how to properly configure EclipseLink to use in my first JPA application, so that I can resolve the problem of 'Communications Link failure', which happens after a while of application inactivity. I am using Java SE, Tomcat 6 as the container, and MySQL as the database. The persistence.xml file specifies a direct connection to the database (I've included the driver url, user and database properties in the persistence.xml file). How should I modify this configuration to properly handle the communication failures? (I've seen this same Java exception posted about and discussed in many internet posts, but I cannot see anywhere what a solution would look like in my simple configuration). Is it possible to resolve in this "direct-connection' , 'resource-local' configuration? If so, could you please post an example persistence.xml that does it. Thanks in advance.
|
|
|
|
|
|
Re: Need to figure out how to properly configure EclipseLink [message #634706 is a reply to message #634685] |
Fri, 22 October 2010 19:22 |
Missing name Mising name Messages: 34 Registered: October 2010 |
Member |
|
|
I'm now experimenting with the definition of a JNDI datasource (so I can use this instead of the direct connection approach in persistence.xml). I've pretty much followed the article in http://wiki.eclipse.org/EclipseLink/Examples/JPA/Tomcat_Web_ Tutorial#JNDI_Datasource_Setup , using a 'non-jta data source'. Unfortunately, when my code runs, after apparently successfully deploying the data source, it throws an Exception the first time it creates an EntityManager, as follows:
------------------------------------------------------------ -----------------
[EL Severe]: 2010-10-22 14:00:44.872--ServerSession(6200759)--Thread(Thread[main,5,m ain])--java.lang.UnsupportedOperationException: Not supported by BasicDataSource
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(Ba sicDataSource.java:899)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIC onnector.java:135)
at org.eclipse.persistence.sessions.JNDIConnector.connect(JNDIC onnector.java:94)
at org.eclipse.persistence.sessions.DatasourceLogin.connectToDa tasource(DatasourceLogin.java:162)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.connectInternal(DatasourceAccessor.java:327)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAcce ssor.connectInternal(DatabaseAccessor.java:294)
at org.eclipse.persistence.internal.databaseaccess.DatasourceAc cessor.connect(DatasourceAccessor.java:415)
at org.eclipse.persistence.sessions.server.ConnectionPool.build Connection(ConnectionPool.java:155)
at org.eclipse.persistence.sessions.server.ExternalConnectionPo ol.startUp(ExternalConnectionPool.java:118)
at org.eclipse.persistence.sessions.server.ServerSession.connec t(ServerSession.java:495)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.login(DatabaseSessionImpl.java:632)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryPro vider.login(EntityManagerFactoryProvider.java:230)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl. deploy(EntityManagerSetupImpl.java:368)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.getServerSession(EntityManagerFactoryImpl.java:151)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.createEntityManager(EntityManagerFactoryImpl.java:195)
at edu.northwestern.at.ggdashboard.persistence.PersistenceServi ce.getEntityManager(PersistenceService.java:31)
---------------------------------------------------
Any suggestions on what may be causing this? (please keep in mind that I'm using Java SE, Tomcat 6, eclipselink and MySQL)
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04440 seconds