Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My company has a web application that allows users as part of their business process to upload large documents (10+ MBs) into the application. For fast connections it works great with the document successfully being loaded into the Oracle database. If the connection is slow then we get the following stack trace in the logs and the document fails to upload into the database:

2014-01-22 11:44:46,085 [XXX ERROR] [XXXXX.controller.BaseRequestProcessor  231]  com.XXXXX.XXXXX.exception.DataAccessException: java.lang.NullPointerException
com.XXXXX.XXXXX.exception.DataAccessException: java.lang.NullPointerException
    at com.XXXXX.XXXXX.dao.SessionManager.rollback(SessionManager.java:258)
    at com.XXXXX.XXXXX.tracking.service.TrackingService.requestUpdateChild(TrackingService.java:1354)
    at com.XXXXX.XXXXX.tracking.controller.action.TrackingAction.prepareUpdate(TrackingAction.java:711)
    at com.XXXXX.XXXXX.tracking.controller.action.TrackingAction.requestUpdate(TrackingAction.java:639)
    at sun.reflect.GeneratedMethodAccessor726.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274)
    at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
    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 com.XXXXX.XXXXX.web.filter.AuthenticationFilter.continueProcessing(AuthenticationFilter.java:256)
    at com.XXXXX.XXXXX.web.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:134)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.XXXXX.XXXXX.web.filter.CacheFilter.doFilter(CacheFilter.java:108)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.XXXXX.XXXXX.web.filter.TrackingStateFilter.doFilter(TrackingStateFilter.java:88)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at com.XXXXX.XXXXX.web.filter.ConcurrentUserFilter.doFilter(ConcurrentUserFilter.java:111)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:206)
    at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:179)
    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:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:429)
    at org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpAprProtocol.java:384)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1665)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at com.XXXXX.XXXXX.tracking.service.TrackingService.getWorkflowInstance(TrackingService.java:2283)
    at com.XXXXX.XXXXX.tracking.service.TrackingService.requestUpdateChild(TrackingService.java:1305)

Which is usually followed by:

2014-01-22 12:02:44,235 [XXX ERROR] [hibernate.transaction.JDBCTransaction  232]  Could not toggle autocommit
java.sql.SQLRecoverableException: Closed Connection

AND

2014-01-22 12:02:44,236 [XXX ERROR] [hibernate.transaction.JDBCTransaction  202]  JDBC rollback failed
java.sql.SQLRecoverableException: Closed Connection

We've been working on the Tomcat connection settings and we have them set to:

    <Connector port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8"
       connectionUploadTimeout="36000000" disableUploadTimeout="false"
       connectionTimeout="60000" redirectPort="8443" />

I'm thinking that this is in some way related to Tomcat closing the connection to the database because it's taking a long time to upload the file. Then when the file is finally uploaded to Tomcat and Tomcat tries to commit the file to the database it can't because the connection is closed so then it fails out.

Anyone seen any similar issues and find a solution for them?

Thanks!

share|improve this question
    
Check to see if you have any of these connects getting closed by firewall. It's possible the available connections are not getting tested then when app tries to use it you see this happen. The Oracle DBA can use sqlnet to help keep connections in active state so a firewall will not close them. If no firewall, then forget all of this then... –  Schrute Jan 27 at 23:15
add comment

1 Answer

From the looks of it, at least there's likely a bug in the TrackingManager class since it throws a NullPointerException. This could be the cause or a symptom.

Hibernate is trying to roll back but finds a closed DB connection and cannot.

So I'd say either your code, connection pooling or the database is closing the connection prematurely.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.