Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] DB Connection Pool Problem

Please log a bug for the null-pointer.  The code in ServerSession should be
checking if the SequenceServer is null.  A workaround would be to define a
descriptor that uses sequencing.

You can use a DataSource with EclipseLink either through registering one in
JNDI, or by passing one directly in code either using the
"javax.persistence.nonJtaDataSource" persistence unit property, or using a
SessionCustomizer to set one on the Session's DatabaseLogin, JNDIConnector.


mesutso wrote:
> 
> Hi,
> 
> In my application, I used eclipselink(2.0.0.v20090731-r4765) jpa in java
> sdk platform with mysql 5.1.37. My application use db connection pool
> provided by eclipselink. I encountered with a problem under heavy traffic
> that cause to some of my db connections is hanging or not closed properly.
> 
> First application throws a null pointer exception while it tries to
> release a connection.
> 
> java.lang.NullPointerException
>         at
> org.eclipse.persistence.sessions.server.ServerSession.setCheckConnections(ServerSession.java:776)
>         at
> org.eclipse.persistence.sessions.server.ConnectionPool.releaseConnection(ConnectionPool.java:268)
>         at
> org.eclipse.persistence.sessions.server.ServerSession.releaseClientSession(ServerSession.java:728)
>         at
> org.eclipse.persistence.sessions.server.ClientSession.release(ClientSession.java:465)
>         at
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commitInternal(EntityTransactionImpl.java:99)
>         at
> org.eclipse.persistence.internal.jpa.transaction.EntityTransactionImpl.commit(EntityTransactionImpl.java:63)
> 
> After that it tries to use same db connection and throws another exception
> related to DB communication failure.(I am not sure about this, it is just
> my opinion.)
> 
> 
> Exception [EclipseLink-4002] (Eclipse Persistence Services -
> 2.0.0.v20090731-r4765): org.eclipse.persistence.exceptions.DatabaseExce
> ption
> @
> 
> 
> Exception [EclipseLink-4002] (Eclipse Persistence Services -
> 2.0.0.v20090731-r4765): org.eclipse.persistence.exceptions.DatabaseExce
> ption
> Internal Exception:
> com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No
> operations allowed after connection clo
> sed.Connection was implicitly closed due to underlying exception/error:
> 
> 
> ** BEGIN NESTED EXCEPTION **
> 
> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException
> MESSAGE: Communications link failure
> 
> The last packet successfully received from the server was 1,237
> milliseconds ago.  The last packet sent successfully to the server w
> as 1,236 milliseconds ago.
> 
> STACKTRACE:
> 
> com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications
> link failure
> 
> The last packet successfully received from the server was 1,237
> milliseconds ago.  The last packet sent successfully to the server w
> as 1,236 milliseconds ago.
>         at sun.reflect.GeneratedConstructorAccessor32.newInstance(Unknown
> Source)
>         at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>         at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
>         at
> com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
>         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3030)
>         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2916)
>         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3459)
>         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957)
>         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107)
>         at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
>         at
> com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086)
>         at
> com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2237)
>         at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:876)
>         at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:589)
>         at
> org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:517)
>         at
> org.eclipse.persistence.internal.sessions.ExclusiveIsolatedClientSession.executeCall(ExclusiveIsolatedClientSession.java:
> 63)
>         at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:205)
>         at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:191)
>         at
> org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectOneRow(DatasourceCallQueryMechanism.java:619)
>         at
> org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRowFromTable(ExpressionQueryMechanism.java:256
> 4)
>         at
> org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectOneRow(ExpressionQueryMechanism.java:2535)
>         at
> org.eclipse.persistence.queries.ReadObjectQuery.executeObjectLevelReadQuery(ReadObjectQuery.java:431)
>         at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:992)
>         at
> org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:670)
>         at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:953)
>         at
> org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:399)
>         at
> org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1016)
>         at
> org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2864)
>         at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1208)
>         at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1190)
>         at
> org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1150)
>         at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.executeQuery(EntityManagerImpl.java:642)
>         at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.findInternal(EntityManagerImpl.java:586)
> 
>         at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.executeQuery(EntityManagerImpl.java:642)
>         at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.findInternal(EntityManagerImpl.java:586)
>         at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:490)
>         at
> org.eclipse.persistence.internal.jpa.EntityManagerImpl.find(EntityManagerImpl.java:369)
>         at
> tr.com.argela.tmh.cache.db.dao.SubscriberProfileDao.findByPk(SubscriberProfileDao.java:21)
>         at
> tr.com.argela.tmh.cache.core.http.HttpRequestHelper.saveResponse2Cache(HttpRequestHelper.java:249)
>         at
> tr.com.argela.tmh.cache.core.http.HttpRequestHelper.processHttpMessage(HttpRequestHelper.java:125)
>         at
> tr.com.argela.tmh.cache.core.http.server.MessageAcceptor.doJob(MessageAcceptor.java:70)
>         at
> tr.com.argela.tmh.cache.core.http.server.MessageAcceptor.doPost(MessageAcceptor.java:35)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
>         at
> org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:521)
>         at
> org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:436)
>         at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:118)
>         at
> org.eclipse.jetty.server.session.SessionHandler.handle(SessionHandler.java:179)
>         at
> org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:930)
>         at
> org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:371)
>         at
> org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:864)
>         at
> org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:116)
>         at
> org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:243)
>         at
> org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:112)
>         at org.eclipse.jetty.server.Server.handle(Server.java:337)
>         at
> org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:562)
>         at
> org.eclipse.jetty.server.HttpConnection$RequestHandler.content(HttpConnection.java:1000)
>         at
> org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:736)
>         at
> org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:209)
>         at
> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:415)
>         at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:437)
>         at
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:435)
>         at java.lang.Thread.run(Thread.java:619)
> Caused by: java.net.SocketException: Connection reset
>         at java.net.SocketInputStream.read(SocketInputStream.java:168)
>         at
> com.mysql.jdbc.util.ReadAheadInputStream.fill(ReadAheadInputStream.java:113)
>         at
> com.mysql.jdbc.util.ReadAheadInputStream.readFromUnderlyingStreamIfNecessary(ReadAheadInputStream.java:160)
>         at
> com.mysql.jdbc.util.ReadAheadInputStream.read(ReadAheadInputStream.java:188)
>         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2472)
>         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2927)
>         ... 56 more
> 
> 
> ** END NESTED EXCEPTION **
> 
> 
> I made some googling but did not find any information related to that
> problem.
> And one another question is; 
>      * How can I provide another db connection pool to eclipselink while
> not using eclipselink in an application server platform ?
>      * How can I tell to eclipselink db connection pool to test the db
> connection before using it ? 
> 
> Thanks for comments and suggestions that would help to fix the problem.
> Regards,
> 
> Mesut SOYTURK.
> Argela Technologies
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/DB-Connection-Pool-Problem-tp25343735p25388672.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top