here an error which drives me crazy, which seems to have tons of related entries but non solution worked so far. Maybe there is something special about my configuration I haven't found so far...
Im running a Java application, using Hibernation (5.0.3.Final) connected an Azure SQL DB (v12) via JNDI ressources (tomcat 8.0.28).
I am receiving, as it looks randomly, Connection reset by peer: socket write error's followed by The connection is closed errors. The app does not recover until restart...
This happens despite the fact that i have configured a validationQuery and also set testOnCreate, testOnBorrow and testWhileIdle to true.
I'll give you the whole configuration below. This really drives me crazy as this seems to be a bug which is well known but not solved since years?!
Here's the configuration:
server.xml:
<Resource name="jdbc/booking"
global="jdbc/booking"
auth="Container"
username="XXX"
password="YYY"
type="javax.sql.XADataSource"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://mydatabase.database.windows.net:1433;database=booking;encrypt=true;trustServerCertificate=false;hostNameInCertificate=*.database.windows.net;loginTimeout=30;"
factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
maxWait="10000"
validationQuery="SELECT 1"
testOnCreate="true"
testOnBorrow="true"
testWhileIdle="true"
timeBetweenEvictionRunsMillis="30000"
minEvictableIdleTimeMillis="60000"
validationInterval="1000"
removeAbandonedOnMaintenance="true"
fastFailValidation="true"/>
context.xml (in web/META-INF/ of the war)
<ResourceLink name="jdbc/booking" global="jdbc/booking"/>
hibernate.cfg
<property name="connection.driver_class">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
<property name="connection.datasource">java:comp/env/jdbc/booking</property>
I'm setting up the Hibernate session factory like this:
private void setUp() {
final StandardServiceRegistry registry = new StandardServiceRegistryBuilder().configure( AzureDB.configFile ).build();
try {
this.sessionFactory = new MetadataSources( registry ).buildMetadata().buildSessionFactory();
} catch ( final Exception e ) {
System.err.println( e.getMessage() );
StandardServiceRegistryBuilder.destroy( registry );
System.exit( 666 );
}
}
and use it via injection in my services like this:
#Inject private AzureDB bookingDB;
...
this.bookingDB.getCurrentSession().beginTransaction();
final Hotel hotel = this.bookingDB.getCurrentSession().get( Hotel.class, hotelId );
One request will finish successfully, the next will run into the Connection rest by peer error. A full stracktrace will look like this:
16-Nov-2015 09:26:59.028 WARN [http-apr-8080-exec-13] org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logExceptions SQL Error: 0, SQLState: 08S01
16-Nov-2015 09:26:59.028 ERROR [http-apr-8080-exec-13] org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logExceptions Connection reset by peer: socket write error
16-Nov-2015 09:26:59.044 INFO [http-apr-8080-exec-13] org.hibernate.event.internal.DefaultLoadEventListener.onLoad HHH000327: Error performing load command : org.hibernate.exception.JDBCConnectionException: could not extract ResultSet
16-Nov-2015 09:26:59.060 SEVERE [http-apr-8080-exec-13] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [com.nekst.service.nekstAPI] in context with path [] threw exception [org.hibernate.exception.JDBCConnectionException: could not extract ResultSet] with root cause
com.microsoft.sqlserver.jdbc.SQLServerException: Connection reset by peer: socket write error
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1748)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:1732)
at com.microsoft.sqlserver.jdbc.TDSChannel.write(IOBuffer.java:1842)
at com.microsoft.sqlserver.jdbc.TDSWriter.flush(IOBuffer.java:4161)
at com.microsoft.sqlserver.jdbc.TDSWriter.writePacket(IOBuffer.java:4062)
at com.microsoft.sqlserver.jdbc.TDSWriter.endMessage(IOBuffer.java:3107)
at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:6700)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:424)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:372)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:6276)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1793)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:184)
at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:159)
at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:284)
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.getResultSet(AbstractLoadPlanBasedLoader.java:433)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeQueryStatement(AbstractLoadPlanBasedLoader.java:185)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:120)
at org.hibernate.loader.plan.exec.internal.AbstractLoadPlanBasedLoader.executeLoad(AbstractLoadPlanBasedLoader.java:85)
at org.hibernate.loader.entity.plan.AbstractLoadPlanBasedEntityLoader.load(AbstractLoadPlanBasedEntityLoader.java:167)
at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3954)
at org.hibernate.event.internal.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:488)
at org.hibernate.event.internal.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:453)
at org.hibernate.event.internal.DefaultLoadEventListener.load(DefaultLoadEventListener.java:196)
at org.hibernate.event.internal.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:258)
at org.hibernate.event.internal.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:134)
at org.hibernate.internal.SessionImpl.fireLoad(SessionImpl.java:1071)
at org.hibernate.internal.SessionImpl.access$2600(SessionImpl.java:164)
at org.hibernate.internal.SessionImpl$IdentifierLoadAccessImpl.load(SessionImpl.java:2638)
at org.hibernate.internal.SessionImpl.get(SessionImpl.java:955)
at sun.reflect.GeneratedMethodAccessor160.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.hibernate.context.internal.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:338)
at com.sun.proxy.$Proxy138.get(Unknown Source)
at com.nekst.service.rest.Kauai.getLocation(Kauai.java:227)
at com.nekst.service.rest.Kauai.getRecommendation(Kauai.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:217)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
at com.googlecode.psiprobe.Tomcat80AgentValve.invoke(Tomcat80AgentValve.java:45)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2503)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2492)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
followed by com.microsoft.sqlserver.jdbc.SQLServerException: The connection is closed. on any succeeding request.
There can be weeks of undisturbed service and then (like currently) I see this errors continuously... Has anybody experience in this concrete setting or any other remarks to my situation? Help is appreciated a lot...
UPDATE: I also tried adding custom registry entries as suggested here: https://msdn.microsoft.com/en-us/library/hh290696(v=SQL.110).aspx, no luck, I can see the keepalives in wireshark, but still getting those errors
Per my experience, the issue was generally caused by using the unsuitable configuration for the JDBC connection pool in JNDI.
There is a offical doc for the Azure SQL Database resource limits https://azure.microsoft.com/en-us/documentation/articles/sql-database-resource-limits/.
I checked your JNDI configuration. So I suggest you can refer to your Azure service tier's limits and the Tomcat doc for JDBC data source settings in JNDI https://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html#JDBC_Data_Sources to set the configuration properties initialSize, maxActive,minIdle and maxIdle to suitable values like maxIdle=100.
Update:
The initialSize & minIdle default value is 0. The minIdle property control the pool connection minimal count when the pool release the connection with low concurrent access. If the pool connection released till 0, the new access will cause the issue connection reset.
Updated at 2015.11.19:
There is an excerpt explained the issue Connection reset by peer.
[10054] Connection reset by peer
Connection reset by peer is a tough one because it can be caused by so many things. In all cases, the server determines that the socket is no longer good and closes it from its side.
Write Error
Scenario: Mary was trying to talk to Joe but didn't think she was getting through, so she hung rather than lose his messages (data).
A write error occurs when a server cannot successfully write to a user's client. When the server receives information, it usually responds with information of its own. When the server receives an error when writing to a client, it then disconnects the user, resulting in a write error quit message similar to the read error format.
Try to set the Idle timeout value to some large value. Do you observe any pattern as to when this issue occurs? Is there a idle state after which you see this problem? Check - http://www.coderanch.com/t/633566/JDBC/databases/microsoft-sqlserver-jdbc-SQLServerException-Connection
This also explains the same behavior due to timeout - DBCP returns closed connections
Try to turn on the logging for the driver by following the link - https://msdn.microsoft.com/en-us/library/ms378517(v=SQL.110).aspx
Use the finest level logging and check if you can get the details of the problem.
I am getting this error when I am trying to update values in my database from my spring mvc application :
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy21.updatePerson(Unknown Source)
at se.lowdin.civilforsvaret.webapp.controller.EditPersonContoller.save(EditPersonContoller.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
DEBUG: org.hibernate.jdbc.AbstractBatcher - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
TRACE: org.hibernate.jdbc.AbstractBatcher - closing statement
ERROR: org.hibernate.event.def.AbstractFlushingEventListener - Could not synchronize database state with session
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy21.updatePerson(Unknown Source)
at se.lowdin.civilforsvaret.webapp.controller.EditPersonContoller.save(EditPersonContoller.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
TRACE: org.hibernate.jdbc.ConnectionManager - registering flush end
DEBUG: org.hibernate.transaction.JDBCTransaction - rollback
DEBUG: org.hibernate.transaction.JDBCTransaction - re-enabling autocommit
DEBUG: org.hibernate.transaction.JDBCTransaction - rolled back JDBC Connection
TRACE: org.hibernate.jdbc.JDBCContext - after transaction completion
DEBUG: org.hibernate.jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
TRACE: org.hibernate.impl.SessionImpl - after transaction completion
TRACE: org.hibernate.impl.SessionImpl - closing session
TRACE: org.hibernate.jdbc.ConnectionManager - performing cleanup
DEBUG: org.hibernate.jdbc.ConnectionManager - releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
TRACE: org.hibernate.jdbc.JDBCContext - after transaction completion
DEBUG: org.hibernate.jdbc.ConnectionManager - transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
TRACE: org.hibernate.impl.SessionImpl - after transaction completion
feb 07, 2014 11:04:32 FM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [spring] in context with path [/CRUDWebAppMavenized] threw exception [Request processing failed; nested exception is org.springframework.orm.hibernate3.HibernateOptimisticLockingFailureException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1; nested exception is org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1] with root cause
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:61)
at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:46)
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:68)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:48)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:242)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:235)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:140)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:656)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:393)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:120)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
at com.sun.proxy.$Proxy21.updatePerson(Unknown Source)
at se.lowdin.civilforsvaret.webapp.controller.EditPersonContoller.save(EditPersonContoller.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
So my actual error seem to be something with the ID´s in the database and whats being updated.
In my GET method I am getting the current ID which in this case is 10.
#Autowired
PersonService service;
#RequestMapping(method = RequestMethod.GET)
public ModelAndView index(#PathVariable int id) {
EditPersonBean bean = new EditPersonBean();
if (id > 0) {
Person person = service.getPerson(id);
bean.copyValuesToBean(person);
}
ModelAndView mav = new ModelAndView("editPerson");
mav.addObject("editPersonBean", bean);
return mav;
}
But in my post method this ID that was 10 is suddenly 0 which I belive might be the cause of this error?
#RequestMapping(value = "/edit", method = RequestMethod.POST)
public String save (EditPersonBean bean, Person person, #RequestParam(value = "file", required = false) MultipartFile file) {
System.out.println("incoming id : " + bean.getId());
try {
Blob blob = Hibernate.createBlob(file.getInputStream());
bean.copyBeanValuesToPerson(person,blob);
service.updatePerson(person);
} catch (IOException e) {
e.printStackTrace();
}
return "redirect:/person.html";
}
What then could be the cause of this or is the error something else?
public class EditPersonBean {
private int id;
private String firstName;
private String lastName;
private String email;
private String phoneNumber;
private String otherInfo;
private Blob image;
private String userName;
private String password;
public void copyValuesToBean(Person person){
setId((int) person.getId());
setFirstName(person.getFirstName());
setLastName(person.getLastName());
setEmail(person.getEmail());
setPhoneNumber(person.getPhoneNumber());
setOtherInfo(person.getOtherInfo());
setImage(person.getImage());
setUserName(person.getUserName());
setPassword(person.getPassword());;
}
#Entity
public class Person {
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "ID")
private int id;
#Column(name = "FIRSTNAME")
private String firstName;
#Column(name = "SECONDNAME")
private String lastName;
#Column(name = "EMAIL")
private String email;
#Column(name = "MobilePHONENUM")
private String phoneNumber;
#Column(name = "OTHER")
private String otherInfo;
#Column(name = "image")
#Lob
private Blob image;
#NotEmpty
#Size(min = 1, max = 50)
#Column(name = "username")
private String userName;
#NotEmpty
#Size(min = 1, max = 20)
#Column(name = "password")
private String password;
public Person() {
}
public Person(int id, String firstName, String lastName, String email,
String phoneNumber, String otherInfo, Blob image, String userName, String password) {
setId(id);
setFirstName(firstName);
setLastName(lastName);
setEmail(email);
setPhoneNumber(phoneNumber);
setOtherInfo(otherInfo);
setImage(image);
setUserName(password);
setPassword(userName);
} //Getters and setters...
JPA class :
#Override
public Person getPerson(int personId) {
return (Person)session.getCurrentSession().get(Person.class, personId);
}
This error usually caused when the hibernate can't find all the rows it needs to update.
Meaning that when you try to update some objects that were pulled from the DB they don't really exist anymore (or never existed in the first place).
It might be because another thread is deleting them or that the DB's isolation mode is set to read_uncommited and so rows that were created by another transaction failed to save (due to a transaction failure) and don't exist anymore.
The only way to exactly know what is happening is to turn on Hibernate statement logging in your Hibernate.cfg.xml configuration. That is because none of the line numbers in the stack trace correspond with the part of your code that performed the actual Hibernate operation. Instead, the operations are batched and then executed all at once upon transaction close (or after a specified number of operations have been batched).
To enable Hibernate statement logging,
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
That said, last time I ran into this issue, it was a case of a record being deleted by general HQL update in a different thread/transaction, then the current thread/transaction trying to delete the exact same record by ID. Unfortunately since the transaction is batched you don't see it at the point you did the delete but, rather, at some point way later in the program execution. Thus the need to turn on statement logging to see which actual Hibernate operation triggered the exception.
I was also facing this in my Spring boot app. My case is like below:
Outter method annotated with #Transaction. Inside this, i have two different method:
Method 1 is deleting records which is also having #Transaction.
Method 2 is reading the same records , also annotated with #Transaction.
Here issue occur because by default #Transaction annotation support Propagation.REQUIRED which uses current Transaction. So In Method 2 when i try to read the data,it will obviously get Stale exception.
The fix which work for me is i annotate Method 1 with
#Transactional(propagation = Propagation.REQUIRES_NEW)
So that Method 2 always uses a separate Transaction which will not have Stale data.
I ran into similar problem, where I was trying to save an object where his id was a primitive field (long), and at the time of create the object, the id was set to 0 by default, and Hibernate assumed I wanted to update the row with id = 0 (which obviously doesn't exist).
My solution was change the id field to Long (wrapper), and that way, when I create a new instance the id is set to null, and Hibernate understands I am inserting a new element to the database.
I hope it helps. Thanks.
Check if the variable of the Object, that is mapped to the hibernate as Id (which uses a generator class) is not containing any stale value in the first place.
If the record is been deleted by any another thread or operation, but your Id variable is still containing the stale value and when you go for updating the record in the DB, it gives you this exception as there will be no record for the given id in the DB and hence you will have to save the object instead of updating, as there is no scope for updating the record in the first place
Or else
Set the id as null when your are using saveOrUpdate method.
I had the similar issue and when i added cascade='save-update' it resolved my issues.
This is my fix worked with CF Application.
I got this error because I wanted to update data and I used
service.update(user);
But then for testing purpose I cleared
the User table and forgot to change the method to
service.saveOrUpdate(user);
Thus I changed it and the issue was solved.
100 % Solution :
1 make sure id in table is auto increment
all your foreign keys are not null
scope is session
Just type save instead of saveOrUpdate in your hibernate query. This is due to previous logs your class is generating some other ID which was previously stored in your table. So hibernate tries to update with same ID and it finds no row with that ID so it gives a staleStateException.
some Times we use generator class to generate primary key of a row... but we add it force in program at time we will get stalestateException.
student=new Student();
student.setId(4);
student.setName("thatha");
student.setDept("dev");
try {
transaction = session.beginTransaction();
session.save(student);
transaction.commit();
System.out.println("student is updated");
} catch (HibernateException e) {
e.printStackTrace();
transaction.rollback();
System.out.println("tx is rollback");
}
Specify below annotaion attribute inside parent entity class:-
import javax.persistence.CascadeType
import javax.persistence.FetchType
#OneToMany(targetEntity = PhoneNumber.class, cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
One of the scenarios when this exception can occur is when you use spring-data-jpa to persist data in a table which has partitioning enabled.
In that case if you use the crudrepository's save method, you will get this exception. The reason being, under the hood, spring JPA uses hibernate to fire the sql query. If you are inserting the data then this error will occur because insert statement returns "0 rows inserted" as the response of insert statement execution(only when partition is enabled). Hibernate expects 1 to be returned and since it doesn't gets it, it rollback the inserted row.
I would suggest if you are getting this kind of error, then connect to the database and fire the sql query manually from the console and check the response. you should be able to investigate further in your problem.
Another workaround which you can implement in your spring/java/hibernate project is to use the Entity Manager to fire native sql query.
add a cascade for update. will solve the issue if foreign keys are involved.
If Primary Key in a Table is mentioned as auto incremented and you forced to Give value explicitly it will throw Stale state exception.
this exception is mostly occurs when we perform UPDATE operation In hibernate. if we have mention ID as PRIMARY KEY & AUTO_INCREMENT and we are using another id to update the data tends to cause exception...PRIMARY KEY MUST BE SAME
in simple layman language while performing Update operation
ID will be same
rest data can be change
................................
or use cascade property to change ID if u wish
If it is while delete operation for #Entity: check you have not duplication of JPA bindings(#..to..) to the same related records.
In this case JPA implementation can try to delete the same referenced record twice. I got this problem using Hibernate+SpringData.
We are using Spring 2.5.6 and the Hibernate that comes with it.
As part of our architecture, we have a service and a manager. The service calls the manager to provide a unit of work. We place an AOP interceptor around the manager to manage the transaction.
In our case, the manager is creating an image and a note that links that image to a person, then returning back to the service. These are brand new functions.
When I run this I get the following stack trace:
2013-07-11 08:06:52,969 3773870 ERROR org.hibernate.event.def.AbstractFlushingEventListener | Could not synchronize database state with session
org.hibernate.exception.SQLGrammarException: Could not execute JDBC batch update
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:275)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:266)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:167)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:365)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:137)
at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:732)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:701)
at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy50.attachImage(Unknown Source)
at com.acs.gs.juror.service.person.impl.PersonServiceImpl$1.retry(PersonServiceImpl.java:557)
at com.acs.gs.juror.service.Service.withRetry(Service.java:362)
at com.acs.gs.juror.service.person.impl.PersonServiceImpl.attachImage(PersonServiceImpl.java:562)
at com.xerox.tclg.juror.servlet.StoreImageServlet.handleRequestInternal(StoreImageServlet.java:73)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:511)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:600)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1703)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.sql.BatchUpdateException: ORA-00932: inconsistent datatypes: expected NUMBER got BINARY
at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:10345)
at oracle.jdbc.driver.OracleStatementWrapper.executeBatch(OracleStatementWrapper.java:230)
at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.apache.tomcat.dbcp.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 41 more
When I searched on the error, I found a lot entries about queries with null values. The thing is that I've already done the inserts and that worked fine. It's throwing this exception during the commit.
Both image and note are existing fields that I've used in the past. I have recently put a link on note to image so that a note may reference an image.
Just because of the error message, I'm suspicious of the image. Here is the definition of the image data field on the image:
#Column( name = "IMAGE_DATA" )
#Lob()
private byte[ ] imageData;
I'd appreciate any advice as to how to proceed.
The key to the answer is in the lower part of the stacktrace:
ORA-00932: inconsistent datatypes: expected NUMBER got BINARY
Hard to say which field this is about, but since you're working with images there may be something wrong in how you configured persistence for that class / field.
Maybe you should hint Hibernate how to store the field by annotating it with
#Lob(type = LobType.BLOB)
The problem ended up involving a missing annotation.
I had just added an image to note entry and set it up to point to the UUID of the image, but left off #OneToOne. As such, it appeared to be trying to store the image data in a field for UUID.
I Added the #OneToOne and the problem went away. Nathan was also correct in saying that it wasn't actually getting inserted until the commit. To find the issue, I moved these inserts outside of the transaction so that they got inserted immediately. This helped me track down the issue.
I am having a wicket application and I am using Ebean ORM mapping. I have set all the credential in ebean.properties. But I am getting an error message "Could not initialize class com.avaje.ebean.Ebean" when I deployed it on server, Its gives error as follows
Last cause: Could not initialize class com.avaje.ebean.Ebean
WicketMessage: Can't instantiate page using constructor 'public com.zipgrocery.pages.HomePageNew(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument ''. Might be it doesn't exist, may be it is not visible (public).
Stacktrace
Root cause:
java.lang.NoClassDefFoundError: Could not initialize class com.avaje.ebean.Ebean
at com.zipgrocery.data.Merchant.getMerchantsByZone(Merchant.java:374)
at com.zipgrocery.pages.HomePageNew.<init>(HomePageNew.java:77)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:173)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:77)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47)
at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103)
at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264)
at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:244)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:311)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:776)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:705)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:898)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)
Complete stack:
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor 'public com.zipgrocery.pages.HomePageNew(org.apache.wicket.request.mapper.parameter.PageParameters)' and argument ''. Might be it doesn't exist, may be it is not visible (public).
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:196)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:77)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47)
at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103)
at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264)
at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:173)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:77)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:47)
at org.apache.wicket.DefaultMapperContext.newPageInstance(DefaultMapperContext.java:103)
at org.apache.wicket.request.handler.PageProvider.resolvePageInstance(PageProvider.java:264)
at org.apache.wicket.request.handler.PageProvider.getPageInstance(PageProvider.java:165)
at org.apache.wicket.request.handler.render.PageRenderer.getPage(PageRenderer.java:78)
at org.apache.wicket.request.handler.render.WebPageRenderer.renderPage(WebPageRenderer.java:105)
at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:224)
at org.apache.wicket.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:167)
at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:784)
at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:255)
at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:212)
at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:283)
at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:188)
But it works fine when I deploy it on my localhost. I tried to find the solutions for this but not getting. So Help me out...
I'm not familiar with this guy "Ebean ORM", but the error track is pretty generic and seems has nothing really to do with "Ebean ORM" itself. Based on my past exp, it is more like a classloader issue. You said it was running fine locally and then? where is it broken? when you have such issues like "NoClassDefFoundError", always check what classloader is being used. And also it is worth to check whether your broken environment has multiple versions of the class/jar as well as if the server has its embedded version of this class/jar.
I'm connecting to a mainframe environment from Java using comporsys JCA connector. The java application is deployed in JBOSS. The connector configured in that way:
<connection-factories>
<no-tx-connection-factory>
<jndi-name>ComporsysIMSConnector</jndi-name>
<rar-name>ims_connector_port4027_CreditAuth.rar</rar-name>
<connection-definition>de.comporsys.connector.ims.ConnectionFactory</connection-definition>
<min-pool-size>1</min-pool-size>
<max-pool-size>15</max-pool-size>
<shrinking-enabled>true</shrinking-enabled>
<shrink-period-minutes>2</shrink-period-minutes>
<logging-enabled>true</logging-enabled>
<!-- <log-filename>/opt/jboss/xxxx/logs/ims_connector.log</log-filename> -->
<log-filename>D:\ims_connector.log</log-filename>
</no-tx-connection-factory>
</connection-factories>
The communication must no be 100% ok as I see a lot of error in the logs like this:
[2010-12-16 05:21:10,061] WARN (org.jboss.resource.connectionmanager.NoTxConnectionManager:738) - Pearl 1,DE82000,CGN,D5 ,10450565,768209411 - Connection error occured: org.jboss.resource.connectionmanager.NoTxConnectionManager$NoTxConnectionEventListener#3dcbef2a[state=NORMAL mc=de.comporsys.connector.ims.ManagedConnectionImpl#4743f21b handles=1 lastUse=1292++++++++++++ permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$OnePool#7afdd15b context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool#2dbbec72]
de.comporsys.connector.ims.imstoc.ImstocException: IMS Connect-Error: Return=40, Reason=59
at de.comporsys.connector.ims.imstoc.Connection.execute(Connection.java:261)
at de.comporsys.connector.ims.imstoc.IMSTOCWorkunit.execute(IMSTOCWorkunit.java:261)
at de.comporsys.connector.ims.imstoc.IMSTOCWorkunit.resumeTPipe(IMSTOCWorkunit.java:167)
at de.comporsys.connector.ims.imstoc.IMSTOCWorkunit.execute(IMSTOCWorkunit.java:98)
at de.comporsys.connector.AbstractStatement.executeRequest(AbstractStatement.java:45)
at de.comporsys.connector.ims.Statement.execute(Statement.java:101)
at com.xxx.ims.access.GenericImsTransaction.executeUCIAysnc(GenericImsTransaction.java:340)
at com.xxx.ims.access.GenericImsTransaction.executeUCI(GenericImsTransaction.java:127)
at com.xxx.ims.access.GenericImsTransaction.execute(GenericImsTransaction.java:60)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:50)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleOverPaymentResponse(UpdateCheckinIMF.java:367)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:219)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:121)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:22)
at com.xxx.core.rental.VehicleCheckinBC.executeUpdateCheckInWizardTransaction(VehicleCheckinBC.java:541)
at com.xxx.core.rental.VehicleCheckinBC.executeVehicleCheckin(VehicleCheckinBC.java:315)
at com.xxx.merlin.vehiclecheckin.VehicleCheckinMH.processMessage(VehicleCheckinMH.java:112)
at com.xxx.merlin.servlet.util.HttpRequestHandler.handleMessage(HttpRequestHandler.java:150)
at com.xxx.merlin.servlet.util.HttpRequestHandler.processRequest(HttpRequestHandler.java:88)
at com.xxx.merlin.servlet.MerlinServlet.doPost(MerlinServlet.java:22)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.xxx.scope.ServletRequestScopeFilter.doFilter(ServletRequestScopeFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
[2010-12-16 05:21:10,155] WARN (com.xxx.ims.access.GenericImsTransaction:82) - Pearl 1,DE82000,CGN,D5 ,10450565,768209411 - pac71068: ResourceException caught upon IMF execute. IMF body was:/MSKY\/RAN768209411\/MVA10450565\/DOM23021\/DOGY/G8\/COLN\/AGT82000\/OWM\/FLO\/MOPCV\/DLAY\/DOLCGN\/DOD16Dec10/0600\/TAM39058\/ACTA\/RPIY\/ENT\/AUT\/PRTN\#
javax.resource.spi.ResourceAdapterInternalException: de.comporsys.connector.NoActiveTransactionException: connection is not in transaction: de.comporsys.connector.ims.ManagedConnectionImpl#4743f21b
at de.comporsys.connector.AbstractManagedConnection.getActiveTransaction(AbstractManagedConnection.java:216)
at de.comporsys.connector.AbstractStatement.executeRequest(AbstractStatement.java:53)
at de.comporsys.connector.ims.Statement.execute(Statement.java:101)
at com.xxx.ims.access.GenericImsTransaction.executeUCIAysnc(GenericImsTransaction.java:340)
at com.xxx.ims.access.GenericImsTransaction.executeUCI(GenericImsTransaction.java:127)
at com.xxx.ims.access.GenericImsTransaction.execute(GenericImsTransaction.java:60)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:50)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleOverPaymentResponse(UpdateCheckinIMF.java:367)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:219)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:121)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:22)
at com.xxx.core.rental.VehicleCheckinBC.executeUpdateCheckInWizardTransaction(VehicleCheckinBC.java:541)
at com.xxx.core.rental.VehicleCheckinBC.executeVehicleCheckin(VehicleCheckinBC.java:315)
at com.xxx.merlin.vehiclecheckin.VehicleCheckinMH.processMessage(VehicleCheckinMH.java:112)
at com.xxx.merlin.servlet.util.HttpRequestHandler.handleMessage(HttpRequestHandler.java:150)
at com.xxx.merlin.servlet.util.HttpRequestHandler.processRequest(HttpRequestHandler.java:88)
at com.xxx.merlin.servlet.MerlinServlet.doPost(MerlinServlet.java:22)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.xxx.scope.ServletRequestScopeFilter.doFilter(ServletRequestScopeFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
at de.comporsys.connector.ExceptionHandler.handle(ExceptionHandler.java:46)
at de.comporsys.connector.AbstractStatement.executeRequest(AbstractStatement.java:55)
at de.comporsys.connector.ims.Statement.execute(Statement.java:101)
at com.xxx.ims.access.GenericImsTransaction.executeUCIAysnc(GenericImsTransaction.java:340)
at com.xxx.ims.access.GenericImsTransaction.executeUCI(GenericImsTransaction.java:127)
at com.xxx.ims.access.GenericImsTransaction.execute(GenericImsTransaction.java:60)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:50)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleOverPaymentResponse(UpdateCheckinIMF.java:367)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:219)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:229)
at com.xxx.ims.UpdateCheckinIMF.handleRepromptWithEnter(UpdateCheckinIMF.java:280)
at com.xxx.ims.UpdateCheckinIMF.parseOutput(UpdateCheckinIMF.java:208)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:57)
at com.xxx.ims.UpdateCheckinIMF.executeTransactionInternally(UpdateCheckinIMF.java:28)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:121)
at com.xxx.ims.GenericCheckinOperation.executeTransaction(GenericCheckinOperation.java:22)
at com.xxx.core.rental.VehicleCheckinBC.executeUpdateCheckInWizardTransaction(VehicleCheckinBC.java:541)
at com.xxx.core.rental.VehicleCheckinBC.executeVehicleCheckin(VehicleCheckinBC.java:315)
at com.xxx.merlin.vehiclecheckin.VehicleCheckinMH.processMessage(VehicleCheckinMH.java:112)
at com.xxx.merlin.servlet.util.HttpRequestHandler.handleMessage(HttpRequestHandler.java:150)
at com.xxx.merlin.servlet.util.HttpRequestHandler.processRequest(HttpRequestHandler.java:88)
at com.xxx.merlin.servlet.MerlinServlet.doPost(MerlinServlet.java:22)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.xxx.scope.ServletRequestScopeFilter.doFilter(ServletRequestScopeFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:595)
Caused by: de.comporsys.connector.NoActiveTransactionException: connection is not in transaction: de.comporsys.connector.ims.ManagedConnectionImpl#4743f21b
at de.comporsys.connector.AbstractManagedConnection.getActiveTransaction(AbstractManagedConnection.java:216)
at de.comporsys.connector.AbstractStatement.executeRequest(AbstractStatement.java:53)
... 52 more
Unfortunately I do not have any info what does it mean as composys does not support it any more.
Do you have any idea why this happens?
There is an IMSConnectionFactory which initializes the comporsys stuff
public static ConnectionFactory getIMSConnectionFactory() {
InitialContext context;
ConnectionFactory imsConnectionFactory = null;
try {
// Create a Properties Object and set the JNDI properties
Properties jndiProperties = new Properties();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, WizardContext.getInstance().getWizardProperties().getJndiClass());
// Try obtaining a JNDI context so that the application server can be queried
context = new InitialContext(jndiProperties);
// Request the Connection Factory from the application server using a JNDI context lookup
imsConnectionFactory = (ConnectionFactory) context.lookup(WizardContext.getInstance().getWizardProperties().getConnectionJndi());
Ther transaction handling might be in m_IMSStatementSync.execute, but it is a black box as it is a third party stuff. The IMSConnector registere in JBOSS and we access it in a servlet. Details of the transaction handler:
for (int attempts = 1 + tenaciousness; attempts > 0;) {
try {
// Slightly nervous re. the location of this block.
// It looks like it should be above, where it is now commented out,
// but moving it there coincided with failures.
// This may well have just been a coincidence - but it all happened at cutover time,
// so for the sake of safety I've put it back here for now.
m_IMSStatementSync = m_IMSConnection.createStatement(); /* This created by the connection factory */
m_IMSRequest = m_IMSStatementSync.createRequest();
m_IMSRequest.setTimeout(m_WizardConfiguration.getWizardTimeOut());
m_IMSRequest.setTransaction(p_Input.get_TransactionCode());
m_IMSRequest.setCommArea(p_Input);
m_IMSRequest.setLterm(p_Input.get_TSR().get_ID());
m_IMSRequest.setTimer((byte) WizardOperationConstants.IMS_CONNECT_SYNC_TIMEOUT);
// end of block
// Execute the IMS transaction
m_IMSReply = m_IMSStatementSync.execute(m_IMSRequest); /*pac7102*/
attempts = 0;
}
catch (NoActiveTransactionException e) {
if (--attempts < 1) {
tenaciousness >>= 1;
throw (e);
}
try {
wait(rnd());
}
catch (InterruptedException f) { ... }
}
The reason for the warning is fairly explicit from the stack trace:
de.comporsys.connector.NoActiveTransactionException: connection is not in transaction
.... but you would definitely want to clarify whether or not the interface is actually working or not. At any rate, the warning that the connection is not in a transaction is because you have your JCA pool defined as a non-transactional pool. In order to switch to a transactional pool, it should look something like this:
<connection-factories>
<tx-connection-factory>
<jndi-name>ComporsysIMSConnector</jndi-name>
<rar-name>ims_connector_port4027_CreditAuth.rar</rar-name>
<connection-definition>de.comporsys.connector.ims.ConnectionFactory</connection-definition>
<min-pool-size>1</min-pool-size>
<max-pool-size>15</max-pool-size>
<shrinking-enabled>true</shrinking-enabled>
<shrink-period-minutes>2</shrink-period-minutes>
<logging-enabled>true</logging-enabled>
<!-- <log-filename>/opt/jboss/xxxx/logs/ims_connector.log</log-filename> -->
<log-filename>D:\ims_connector.log</log-filename>
</tx-connection-factory>
</connection-factories>
I am assuming this is supported only because the warning message indicates it expects the connections to be in a transaction which is what the tx-connection-factory will do.
I would give it a spin and see what happens.
Transaction connection factory declaration is necessary, but not sufficient.
You also need to add a declarative transaction to the methods that interact with the database. I'd recommend "PROPAGATION=REQUIRED_NEW".
From what location are you initiating the call to your JCA resource?
In other words, what is
at com.xxx.ims.access.GenericImsTransaction.executeUCIAysnc(GenericImsTransaction.java:340)
?
From the stack trace it seems clear that there is no EJB involved here. The call comes in from a Servlet and then propagates to your own code until the JCA connection is being used.
GenericImsTransaction sounds like it does something transactional, but what exactly? You should verify that there is a JTA transaction being started somewhere. In your Servlet you can get a hold of a UserTransaction, which is a simple interface to start and commit JTA transactions:
#Resource
private UserTransaction tx;
If you're using a pre-Java EE 5 version of JBoss AS, then you can use the following code to obtain a UserTransaction:
private UserTransaction getUserTransaction() {
UserTransaction tx = null;
try {
tx = (UserTransaction)new InitialContext().lookup("java:comp/UserTransaction");
} catch (NamingException e) {
throw new RuntimeException("No UserTransaction available at default location, is a transaction manager installed?", e);
}
return tx;
}
Somewhere in your callstack, you then need to call tx.begin(); and afterwards tx.commit() or tx.rollback().
If you're able to use EJB3, then it's easier to let your Servlet call a stateless session bean (#Stateless) and then let this bean call your other code. You will then automatically have a transaction and the container will take care of committing or rolling it back. If you're not yet using EJBs it may be difficult to retrofit the existing code into using them and the manual JTA code may be easier to insert.