Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Constant "Connection closed" errors in new app
Constant "Connection closed" errors in new app [message #900081] Fri, 03 August 2012 16:17 Go to next message
Franz Amador is currently offline Franz Amador
Messages: 2
Registered: August 2012
Junior Member
In my new "hello world" EJB/JPA app, I always get "Connection closed" errors on my first query, and frequently (though not always) when deploying the project. I must have something configured incorrectly, and I'm hoping someone can give me suggestions on where to look.

Windows 7 64-bit
Eclipse 4.2 (Juno) 64-bit
Java 1.6.0_33 64-bit
JPA Generic 2.0
EclipseLink 2.4.0 - Juno
Internal GlassFish 3.1.2.2
Microsoft JDBC Driver 4.0 for SQL Server (sqljdbc4.jar)
Microsoft SQL Server 2008 R2 (SQLEXPRESS)

I'm using a connection pool (through JTA) that I created using the GlassFish admin page with the default settings. "Ping" succeeds. Here is the error from the GlassFish log:

INFO: WEB0671: Loading application [DemoEAR#Demo.war] at [Demo]
INFO: DemoEAR was successfully deployed in 1,066 milliseconds.
INFO: RAR7114: Unable to get ClientInfo for connection
INFO: RAR7115: Unable to set ClientInfo for connection
INFO: Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query. Error was: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Error Code: 0
Call: SELECT ID, VAL FROM entity1 ORDER BY ID ASC
Query: ReadAllQuery(referenceClass=Entity1 sql="SELECT ID, VAL FROM entity1 ORDER BY ID ASC").
INFO: RAR7114: Unable to get ClientInfo for connection
INFO: RAR7115: Unable to set ClientInfo for connection
INFO: Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query. Error was: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Error Code: 0
Call: SELECT ID, VAL FROM entity1 ORDER BY ID ASC
Query: ReadAllQuery(referenceClass=Entity1 sql="SELECT ID, VAL FROM entity1 ORDER BY ID ASC").
INFO: RAR7114: Unable to get ClientInfo for connection
INFO: RAR7115: Unable to set ClientInfo for connection
INFO: Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query. Error was: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Error Code: 0
Call: SELECT ID, VAL FROM entity1 ORDER BY ID ASC
Query: ReadAllQuery(referenceClass=Entity1 sql="SELECT ID, VAL FROM entity1 ORDER BY ID ASC").
INFO: RAR7114: Unable to get ClientInfo for connection
INFO: RAR7115: Unable to set ClientInfo for connection
INFO: Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query. Error was: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Error Code: 0
Call: SELECT ID, VAL FROM entity1 ORDER BY ID ASC
Query: ReadAllQuery(referenceClass=Entity1 sql="SELECT ID, VAL FROM entity1 ORDER BY ID ASC").
INFO: RAR7114: Unable to get ClientInfo for connection
INFO: RAR7115: Unable to set ClientInfo for connection
INFO: Communication failure detected when attempting to perform read query outside of a transaction. Attempting to retry query. Error was: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Error Code: 0
Call: SELECT ID, VAL FROM entity1 ORDER BY ID ASC
Query: ReadAllQuery(referenceClass=Entity1 sql="SELECT ID, VAL FROM entity1 ORDER BY ID ASC").
WARNING: Local Exception Stack:
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
Error Code: 0
Call: SELECT ID, VAL FROM entity1 ORDER BY ID ASC
Query: ReadAllQuery(referenceClass=Entity1 sql="SELECT ID, VAL FROM entity1 ORDER BY ID ASC")
at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1494)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:636)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1717)
at org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:566)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:264)
at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:646)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2611)
at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2570)
at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:420)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1081)
at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1040)
at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:392)
at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1128)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
at org.eclipse.persistence.internal.sessions.AbstractSession.retryQuery(AbstractSession.java:1586)
at org.eclipse.persistence.sessions.server.ClientSession.retryQuery(ClientSession.java:593)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.retryQuery(UnitOfWorkImpl.java:5464)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1552)
at org.eclipse.persistence.internal.sessions.AbstractSession.retryQuery(AbstractSession.java:1586)
at org.eclipse.persistence.sessions.server.ClientSession.retryQuery(ClientSession.java:593)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.retryQuery(UnitOfWorkImpl.java:5464)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1552)
at org.eclipse.persistence.internal.sessions.AbstractSession.retryQuery(AbstractSession.java:1586)
at org.eclipse.persistence.sessions.server.ClientSession.retryQuery(ClientSession.java:593)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.retryQuery(UnitOfWorkImpl.java:5464)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1552)
at org.eclipse.persistence.internal.sessions.AbstractSession.retryQuery(AbstractSession.java:1586)
at org.eclipse.persistence.sessions.server.ClientSession.retryQuery(ClientSession.java:593)
at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.retryQuery(UnitOfWorkImpl.java:5464)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1552)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1463)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:485)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:742)
at com.centricsoftware.demo.module1.Module1.addEntity1(Module1.java:23)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.glassfish.ejb.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1052)
at org.glassfish.ejb.security.application.EJBSecurityManager.invoke(EJBSecurityManager.java:1124)
at com.sun.ejb.containers.BaseContainer.invokeBeanMethod(BaseContainer.java:5388)
at com.sun.ejb.EjbInvocation.invokeBeanMethod(EjbInvocation.java:619)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
at com.sun.ejb.EjbInvocation.proceed(EjbInvocation.java:571)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.doAround(SystemInterceptorProxy.java:162)
at com.sun.ejb.containers.interceptors.SystemInterceptorProxy.aroundInvoke(SystemInterceptorProxy.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:861)
at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:800)
at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:370)
at com.sun.ejb.containers.BaseContainer.__intercept(BaseContainer.java:5360)
at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:5348)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:214)
at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:89)
at $Proxy216.addEntity1(Unknown Source)
at com.centricsoftware.demo.module1.__EJB31_Generated__Module1__Intf____Bean__.addEntity1(Unknown Source)
at com.centricsoftware.demo.server.GreetingServiceImpl.greetServer(GreetingServiceImpl.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:770)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(SQLServerException.java:190)
at com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolProxy.checkClosed(SQLServerConnectionPoolProxy.java:55)
at com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolProxy.prepareStatement(SQLServerConnectionPoolProxy.java:207)
at com.sun.gjc.spi.base.ConnectionHolder.prepareStatement(ConnectionHolder.java:562)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareCachedStatement(ConnectionWrapper40.java:255)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareCachedStatement(ConnectionWrapper40.java:52)
at com.sun.gjc.spi.ManagedConnection.prepareCachedStatement(ManagedConnection.java:993)
at com.sun.gjc.spi.jdbc40.ConnectionWrapper40.prepareStatement(ConnectionWrapper40.java:173)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1474)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.prepareStatement(DatabaseAccessor.java:1423)
at org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStatement(DatabaseCall.java:697)
at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:585)
... 98 more
Re: Constant "Connection closed" errors in new app [message #900779 is a reply to message #900081] Wed, 08 August 2012 09:02 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Include your persistence.xml.


James : Wiki : Book : Blog : Twitter
Re: Constant "Connection closed" errors in new app [message #900831 is a reply to message #900779] Wed, 08 August 2012 12:33 Go to previous messageGo to next message
Franz Amador is currently offline Franz Amador
Messages: 2
Registered: August 2012
Junior Member
persistence.xml (I blanked out the URLs because eclipse.org won't let me post them):

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="..." xmlns:xsi="..." xsi:schemaLocation="...">
<persistence-unit name="DemoEJB">
<jta-data-source>jdbc/DemoDatabase</jta-data-source>
</persistence-unit>
</persistence>

Also, here's the connection pool definition from GlassFish's domain.xml (I blanked out the password):

<jdbc-connection-pool driver-classname="" datasource-classname="com.microsoft.sqlserver.jdbc.SQLServerConnectionPoolDataSource" res-type="javax.sql.ConnectionPoolDataSource" description="" name="DemoDatabase">
<property name="User" value="demo"></property>
<property name="DatabaseName" value="demo"></property>
<property name="ApplicationName" value="Microsoft JDBC Driver for SQL Server"></property>
<property name="LockTimeout" value="-1"></property>
<property name="Password" value="..."></property>
<property name="SendTimeAsDatetime" value="true"></property>
<property name="PacketSize" value="8000"></property>
<property name="SendStringParametersAsUnicode" value="true"></property>
<property name="XopenStates" value="false"></property>
<property name="TrustServerCertificate" value="false"></property>
<property name="URL" value="jdbc:sqlserver://"></property>
<property name="PortNumber" value="1433"></property>
<property name="LoginTimeout" value="15"></property>
<property name="ResponseBuffering" value="adaptive"></property>
<property name="MultiSubnetFailover" value="false"></property>
<property name="SelectMethod" value="direct"></property>
<property name="LastUpdateCount" value="true"></property>
<property name="WorkstationID" value="drizzle"></property>
<property name="Encrypt" value="false"></property>
<property name="ApplicationIntent" value="readwrite"></property>
</jdbc-connection-pool>
<jdbc-resource pool-name="DemoDatabase" description="" jndi-name="jdbc/DemoDatabase"></jdbc-resource>

And lastly, since I posted my question, I set up MySql in a similar way. When I use it, I do not get the Connection Closed errors.
Re: Constant "Connection closed" errors in new app [message #910401 is a reply to message #900081] Sun, 09 September 2012 10:37 Go to previous message
Deb Wus is currently offline Deb Wus
Messages: 1
Registered: September 2012
Junior Member
I am having a similar issue. Previously used Sprint2000.jar but when changing jdbc driver to sqljdbc4.jar get intermittent Connection is closed. Using tomcat-jdbc pooling. When reverting back to TDS Driver I do not receive the error with same code, same database.
Previous Topic:Why is EclipseLink querying twice for the same entity?
Next Topic:How create JDBC connection in EcelipseLInk application
Goto Forum:
  


Current Time: Sat Jul 26 13:25:08 EDT 2014

Powered by FUDForum. Page generated in 0.09140 seconds