当前位置: 代码迷 >> J2EE >> ssh2 项目 Tomcat 装死
  详细解决方案

ssh2 项目 Tomcat 装死

热度:920   发布时间:2016-04-17 23:48:48.0
ssh2 项目 Tomcat 假死
本帖最后由 u012403749 于 2014-08-01 15:43:52 编辑
各位大侠,如何解决项目不稳定,经常出现假死情况(最好不重启)
项目采用SSH2框架,数据连接池是 c3po通过SPRING来管理seesion,连接SQL2008数据库
SPRING配置如下:

<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="jdbcUrl" value="jdbc:sqlserver://192.168.0.188:1433" />
<property name="user" value="sa" />
<property name="password" value="sa" />
<property name="minPoolSize" value="2" />
<property name="maxPoolSize" value="100" />
<property name="maxIdleTime" value="1800" />
<property name="acquireIncrement" value="2" />
<property name="maxStatements" value="0" />
<property name="initialPoolSize" value="2" />
<property name="idleConnectionTestPeriod" value="1800" />
<property name="acquireRetryAttempts" value="30" />
<property name="breakAfterAcquireFailure" value="true" />
<property name="testConnectionOnCheckout" value="false" />
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="packagesToScan" value="com.xmm.bean" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
<prop key="hibernate.hbm2ddl.auto">validate</prop> -->
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.jdbc.fetch_size">50</prop>
<prop key="hibernate.jdbc.batch_size">30</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
<prop key="hibernate.cache.region.factory_class">
org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
</prop>
<prop key="hibernate.current_session_context_class">
org.springframework.orm.hibernate4.SpringSessionContext
</prop>
</props>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="del*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="count*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="list*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" read-only="true" />

</tx:attributes>
</tx:advice>

<aop:config>
<aop:pointcut id="serviceMethods" expression="execution(* com.xmm.service..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceMethods" />
</aop:config>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:messages_zh_CN" />
</bean>

操作一段时间 TOMCAT假死,访问项目里的最简单的HTML页面(没有任何代码,纯静态页面)也没有反应

日志
后台输出假死代码(不一定):
[2014-08-01 14:06:26.234] [DEBUG] [http-bio-8080-exec-112] [org.hibernate.internal.SessionImpl:1002] - Initializing proxy: 
[2014-08-01 14:06:26.234] [DEBUG] [http-bio-8080-exec-112] [org.hibernate.loader.Loader:2099] - Loading entity: 



TOMCAT 日志
localhost_access_log
192.168.0.100 - - [01/Aug/2014:14:06:24 +0800] "GET /xmm/dispatchingdetail/dispatching_detail!listAll.do?_=1406873061665 HTTP/1.1" 200 5707
192.168.0.100 - - [01/Aug/2014:14:06:36 +0800] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [01/Aug/2014:14:08:12 +0800] "GET /favicon.ico HTTP/1.1" 404 -



通过IP 100访问最后的日志,然后本机127访问只记录访问 /favicon.ico,后面的就不记录了。

查看TCP端口
Active Connections

  Proto  Local Address          Foreign Address        State           PID