File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Tomcat + JNDI + Oracle Database restart - No more data to read from socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat + JNDI + Oracle Database restart - No more data to read from socket" Watch "Tomcat + JNDI + Oracle Database restart - No more data to read from socket" New topic

Tomcat + JNDI + Oracle Database restart - No more data to read from socket

Jogesh Malapaka

Joined: Nov 28, 2011
Posts: 1
We are facing problem "No more data to read from socket", every time database gets restarted. We are using connection pooling of Tomcat end and getting the connection into static variable, code snippet below. For every operation we are getting connection and closing it after use. Is there any way to counter this or do we need to restert app server every time db is restarted???

Class level variable
private static Connection connectionOracle=null;

Logic to get connection:
if ((connectionOracle == null) || (connectionOracle.isClosed())){
/* For Apache Tomcat connection start*/
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup( "java:/comp/env" );
DataSource ds = (DataSource)envContext.lookup( "jdbc/Docs2GoDB" );
connectionOracle =ds.getConnection();

<Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver" maxActive="20" maxIdle="10" maxWait="-1" name="jdbc/Docs2GoDB" password="aaaa" type="javax.sql.DataSource" url="ul" username="asd"/>

Exception trace:
java.sql.SQLException: No more data to read from socket
at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(
at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(
at oracle.jdbc.driver.T4CTTIfun.receive(
at oracle.jdbc.driver.T4CTTIfun.doRPC(
at oracle.jdbc.driver.T4C8Oall.doOALL(
at oracle.jdbc.driver.T4CCallableStatement.doOall8(
at oracle.jdbc.driver.T4CCallableStatement.executeForRows(
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(
at oracle.jdbc.driver.OraclePreparedStatement.execute(
at oracle.jdbc.driver.OracleCallableStatement.execute(
at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.execute(
at org.apache.struts.action.RequestProcessor.processActionPerform(
at org.apache.struts.action.RequestProcessor.process(
at org.apache.struts.action.ActionServlet.process(
at org.apache.struts.action.ActionServlet.doGet(
at javax.servlet.http.HttpServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at org.apache.catalina.core.StandardWrapperValve.invoke(
at org.apache.catalina.core.StandardContextValve.invoke(
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(
at org.apache.catalina.core.StandardHostValve.invoke(
at org.apache.catalina.valves.ErrorReportValve.invoke(
at org.apache.catalina.valves.AccessLogValve.invoke(
at org.apache.catalina.core.StandardEngineValve.invoke(
at org.apache.catalina.connector.CoyoteAdapter.service(
at org.apache.coyote.ajp.AjpProcessor.process(
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
at java.util.concurrent.ThreadPoolExecutor$

Amir Keibi
Ranch Hand

Joined: Apr 23, 2012
Posts: 49

Did you ever find a solution other than restarting the app server?
I agree. Here's the link:
subject: Tomcat + JNDI + Oracle Database restart - No more data to read from socket
Similar Threads Broken pipe
java.lang.UnsupportedOperationException, JSF2.0, Tomcat 7.0.11
Cannot create a session after the response has been committed
java.lang.NullPointerException at com.sun.faces.context.flash.ELFlash.loggingGetPhaseMapForWriting
datatable selection returning null