CAS连接超时问题,需要刷新一次才能登陆CAS is Unavailable There was an error trying to complete your request.

隔夜第二天来时候发现登陆链接失效,需要刷新一次才行

CAS is Unavailable

There was an error trying to complete your request. Please notify your support desk or try again

Copyright © 2005 - 2010 Jasig, Inc. All rights reserved.

Powered by Jasig Central Authentication Service 3.4.11



日志信息如下:

2012-09-07 09:11:30,235 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

=============================================================

WHO: [username: admin]

WHAT: PreparedStatementCallback; SQL [select passwd from esb_users where enabled=1 and username = ? ]; The last packet successfully received from the server was 60,130,736 milliseconds ago.  The last packet sent successfully to the server was 60,130,737 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 60,130,736 milliseconds ago.  The last packet sent successfully to the server was 60,130,737 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

ACTION: TICKET_GRANTING_TICKET_NOT_CREATED

APPLICATION: CAS

WHEN: Fri Sep 07 09:11:30 GMT+08:00 2012

CLIENT IP ADDRESS: 10.1.81.226

SERVER IP ADDRESS: 10.1.83.34


可使用autoReconnect=true 参数指定,链接不失效即可。

指定如下:

<bean id="casDataSource" class="org.apache.commons.dbcp.BasicDataSource">

<property name="driverClassName">

<value>com.mysql.jdbc.Driver</value>

</property>

<property name="url">

<value>jdbc:mysql://10.1.83.34:3306/icinga?autoReconnect=true</value>

</property>

<property name="username">

<value>icinga</value>

</property>

<property name="password">

<value>icinga</value>

</property>

</bean>

指定后还是有问题,日志报错:

严重: Servlet.service() for servlet cas threw exception
java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2503)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2953)
    at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2942)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3485)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1960)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2114)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2696)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2105)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2264)


经过查找,似乎是mysql5已经不推荐使用autoReconnect接口了

而且如果使用proxool连接池的话,有属性用于链接前后的有效性检查。

于是,我就思考,dhcp应该也有类似的功能吧,最后加入了:

<property name="validationQuery">

<value>SELECT 1 FROM DUAL</value>

</property>

<property name="testOnBorrow">

<value>true</value>

</property>

果然好用了。


另外说说mysql的wait_timeout属性,默认是8小时,

为了测试这个问题,需要把这个值改小点,修改起来还真不好改。

set wait_timeout=5000;

发现我立马就丢失连接了,而且重新来一遍,值又回去了。

set global wait_timeout=5000;

似乎不好用

最后去/etc/my.cnf里设定了,后来发现确实有效了。


评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

day walker

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值