1

Web アプリケーションで問題が発生しています。アプリケーションが java.net.SocketException: Connection reset 例外をスローします。サーバーから応答が返される前にクライアントが接続を閉じたため、この例外がスローされたと思います。同じ設定の開発環境でこの問題を再現できませんでした。Tomcat を再起動すると正常に動作しますが、一定時間後にアプリがこの例外をスローし始めます。私は自分のデータベース接続プールを管理している方法を疑っていますが、前に述べたようにこの問題を再現することはできませんでした.

 org.springframework.dao.DataAccessResourceFailureException: could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query
    at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:625) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:912) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.orm.hibernate3.HibernateTemplate.find(HibernateTemplate.java:904) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at edu.ucla.iamucla.tools.shibboleth.manager.dao.hibernate.ApplicationGroupDaoHibernate.getAllApplicationGroups(ApplicationGroupDaoHibernate.java:73) ~[ApplicationGroupDaoHibernate.class:na]
    at edu.ucla.iamucla.tools.shibboleth.manager.web.HomeController.getApplicationGroups(HomeController.java:74) ~[HomeController.class:na]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_19]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ~[na:1.6.0_19]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ~[na:1.6.0_19]
    at java.lang.reflect.Method.invoke(Method.java:597) ~[na:1.6.0_19]
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.doInvokeMethod(HandlerMethodInvoker.java:710) ~[spring-web-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:152) ~[spring-web-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:414) ~[spring-webmvc-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:402) ~[spring-webmvc-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771) ~[spring-webmvc-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716) ~[spring-webmvc-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647) [spring-webmvc-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552) [spring-webmvc-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) [servlet-api.jar:na]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) [servlet-api.jar:na]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) [catalina.jar:6.0.26]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) [catalina.jar:6.0.26]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) [catalina.jar:6.0.26]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) [catalina.jar:6.0.26]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) [catalina.jar:6.0.26]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [catalina.jar:6.0.26]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [catalina.jar:6.0.26]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) [catalina.jar:6.0.26]
    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190) [tomcat-coyote.jar:6.0.26]
    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291) [tomcat-coyote.jar:6.0.26]
    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769) [tomcat-coyote.jar:6.0.26]
    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698) [tomcat-coyote.jar:6.0.26]
    at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891) [tomcat-coyote.jar:6.0.26]
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690) [tomcat-coyote.jar:6.0.26]
    at java.lang.Thread.run(Thread.java:619) [na:1.6.0_19]
Caused by: org.hibernate.exception.JDBCConnectionException: could not execute query
    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.loader.Loader.doList(Loader.java:2216) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.loader.Loader.list(Loader.java:2099) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:921) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:1) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) ~[spring-orm-3.0.1.RELEASE.jar:3.0.1.RELEASE]
    ... 34 common frames omitted
Caused by: java.sql.SQLException: I/O Error: Connection reset
    at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1053) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.TdsCore.microsoftPrepare(TdsCore.java:1179) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareSQL(ConnectionJDBC2.java:693) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:777) ~[jtds-1.2.4.jar:1.2.4]
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92) ~[commons-dbcp-1.2.1.jar:1.2.1]
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92) ~[commons-dbcp-1.2.1.jar:1.2.1]
    at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.loader.Loader.getResultSet(Loader.java:1787) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.loader.Loader.doQuery(Loader.java:674) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    at org.hibernate.loader.Loader.doList(Loader.java:2213) ~[hibernate-3.2.6.ga.jar:3.2.6.ga]
    ... 44 common frames omitted
Caused by: java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(SocketInputStream.java:168) ~[na:1.6.0_19]
    at java.io.DataInputStream.readFully(DataInputStream.java:178) ~[na:1.6.0_19]
    at java.io.DataInputStream.readFully(DataInputStream.java:152) ~[na:1.6.0_19]
    at net.sourceforge.jtds.jdbc.SharedSocket.readPacket(SharedSocket.java:842) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.SharedSocket.getNetPacket(SharedSocket.java:723) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.ResponseStream.getPacket(ResponseStream.java:466) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.ResponseStream.read(ResponseStream.java:103) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.ResponseStream.peek(ResponseStream.java:88) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.TdsCore.wait(TdsCore.java:3932) ~[jtds-1.2.4.jar:1.2.4]
    at net.sourceforge.jtds.jdbc.TdsCore.executeSQL(TdsCore.java:1046) ~[jtds-1.2.4.jar:1.2.4]
    ... 54 common frames omitted

前の開発者がログをコンソールに書き込んでいたため、非常に大きな catalina.out ファイルが作成されました。それがどのように例外を引き起こすかはわかりませんが、それが唯一の奇妙なことです。以下は私のdb構成です。

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
    <property name="driverClassName" value="${jdbc.driverClassName.sqlserver}"/>
    <property name="url" value="${jdbc.url.sqlserver}"/>
    <property name="username" value="${jdbc.username.sqlserver}"/>
    <property name="password" value="${jdbc.password.sqlserver}"/>
    <property name="maxActive" value="${jdbc.pool.maxActive}" />
    <property name="maxWait" value="${jdbc.pool.maxWait}" />
    <property name="initialSize" value="${jdbc.pool.initialSize}" />
    <property name="maxIdle" value="${jdbc.pool.maxIdle}" />

    <property name="poolPreparedStatements" value="true"/>
    <property name="defaultAutoCommit" value="true"/>


</bean>

誰かがこの問題に光を当てることができれば幸いです.Spring 3.x、Hibernate、SQL Server、tomcat6を使用しています。

4

0 に答える 0