ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jasmin Mehta <Jasmin_Me...@nexweb.org>
Subject Database Connection reset on Oracle 10g AS using Oracle 11g database
Date Tue, 06 Oct 2009 14:05:28 GMT
Larry,

I saw an answer for one of the thread

http://www.mail-archive.com/user-java@ibatis.apache.org/msg03522.html

I have something similar, How do I modify spring.xml file to use 
BasicDataSource feature to ping the query?

 
I have J2EE application running on OC4J application server. Where the 
database connection is dropping / resetting after some idle time. The idle 
time varies from 20 mins to 90 mins. The persistence layer is created 
using Spring and iBatis with Struts as controller.

I am not able to find that why the code / oracle database is trying to 
close the connection before it makes new one.

Here is the exception log:
[05 Oct 2009 11:55:38] DEBUG [SQLErrorCodesFactory] Looking up default 
SQLErrorCodes for DataSource 
[org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy@13478c8]
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Fetching JDBC Connection 
from DataSource
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Fetching JDBC Connection 
from DataSource
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Returning JDBC Connection 
to DataSource
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Returning JDBC Connection 
to DataSource
[05 Oct 2009 11:55:38] DEBUG [SQLErrorCodesFactory] Database product name 
cached for DataSource 
[org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy@13478c8]: 
name is 'Oracle'
[05 Oct 2009 11:55:38] DEBUG [SQLErrorCodesFactory] SQL error codes for 
'Oracle' found
[05 Oct 2009 11:55:38] DEBUG [SQLErrorCodeSQLExceptionTranslator] 
Translating SQLException with SQL state '08006', error code '17002', 
message [  
--- The error occurred in org/nexweb/qol/gcc/ibatis/dao/xml/User.xml.  
--- The error occurred while applying a parameter map.  
--- Check the getUserByUserNameAndRealmName-InlineParameterMap.  
--- Check the statement (query failed).  
--- Cause: java.sql.SQLException: Io exception: Connection reset by peer: 
socket write error]; SQL was [] for task [SqlMapClient operation]
[05 Oct 2009 11:55:38] DEBUG [DataSourceUtils] Returning JDBC Connection 
to DataSource
[05 Oct 2009 11:55:38] DEBUG [UserSqlMapDAO] Could not close JDBC 
Connection
java.sql.SQLException: Already closed.
      at 
org.apache.commons.dbcp.PoolableConnection.close(PoolableConnection.java:84)
      at 
org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.close(PoolingDataSource.java:181)
      at 
org.springframework.jdbc.datasource.DataSourceUtils.doReleaseConnection(DataSourceUtils.java:313)
      at 
org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy$TransactionAwareInvocationHandler.invoke(TransactionAwareDataSourceProxy.java:166)
      at $Proxy0.close(Unknown Source)
      at 
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:218)
      at 
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:271)
      at 
org.nexweb.qol.gcc.ibatis.dao.sqlmaps.UserSqlMapDAO.getUserByUserNameAndRealmName(UserSqlMapDAO.java:26)
      at 
org.nexweb.qol.gcc.ibatis.services.UserService.getUserByUserNameAndRealmName(UserService.java:30)
      at 
org.nexweb.qol.gcc.actions.WelcomeAction.execute(WelcomeAction.java:71)
      at 
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
      at 
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
      at 
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
      at 
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
      at 
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
      at 
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
      at 
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
      at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
      at 
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at 
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
      at 
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
      at 
com.evermind.server.http.ServletRequestDispatcher.unprivileged_forward(ServletRequestDispatcher.java:259)
      at 
com.evermind.server.http.ServletRequestDispatcher.access$100(ServletRequestDispatcher.java:51)
      at 
com.evermind.server.http.ServletRequestDispatcher$2.oc4jRun(ServletRequestDispatcher.java:193)
      at 
oracle.oc4j.security.OC4JSecurity.doPrivileged(OC4JSecurity.java:283)
      at 
com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:198)
      at 
com.evermind.server.http.EvermindPageContext.forward(EvermindPageContext.java:392)
      at _jsp._forward._jspService(_forward.java:48)
      at 
com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
      at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
      at 
oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
      at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
      at 
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
      at 
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
      at 
com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
      at 
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
      at 
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
      at 
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
      at 
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
      at 
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
      at 
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
      at java.lang.Thread.run(Thread.java:595)

Here is the Spring.xml code related to datasource :

 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
                                   "
http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans>
    <bean id="propertyConfigurer"
 
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="classpath:jdbc.properties"/>
    </bean>
 
    <bean id="dataSource"
          class=" org.apache.commons.dbcp.BasicDataSource"> 
        <property name="driverClassName" value="${jdbc.driverClassName}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    </bean> 
 
    <bean id="sqlMapClient"
          class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
        <property name="configLocation">
 
<value>classpath:org/nexweb/qol/gcc/ibatis/config/SqlMapConfig.xml</value>
        </property>
 
        <property name="transactionConfigProperties">
          <props>
                <prop key="autoCommitAllowed">true</prop>
          </props> 
        </property> 
 
       <property name="useTransactionAwareDataSource">
            <value>true</value> 
       </property>
        <property name="transactionConfigClass">
 
<value>com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransactionConfig</value>
        </property>
        <property name="dataSource" ref="dataSource"/> 
    </bean>


******************************************************************************
This email and any files transmitted with it are intended solely for 
the use of the individual or agency to whom they are addressed. 
If you have received this email in error please notify the Navy 
Exchange Service Command e-mail administrator. This footnote 
also confirms that this email message has been scanned for the
presence of computer viruses.

Thank You!            
******************************************************************************


Mime
View raw message