日期:2014-05-17  浏览次数:20668 次

有在SAE上部署JAVA项目的吗? 求帮助
http://sliwey.sinaapp.com/web/front/index.jsp
这是我部署的项目地址

访问数据库时(即点击第二个菜单项)会出错
有人知道吗??

SSH框架版本如下
struts 2.3.15+spring 3.2.5+hibernate 4.2.8

本地一切正常

------解决方案--------------------
mysql 数据库连接超时了。
编辑 /etc/my.cnf(windows 下为 my.ini),将超时时间设置为 10 年,在 [mysqld] 后面加入:
wait_timeout=315360000

然后重启 MySQL
# service mysql restart
搞定。然后重启超时的 java 连接池程序吧。

------解决方案--------------------
mysql Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.

 Communications link failure, then it means that the DB isn't reachable at all. This can have one or more of the following causes:

IP address or hostname in JDBC URL is wrong.
Hostname in JDBC URL is not recognized by local DNS server.
Port number is missing or wrong in JDBC URL.
DB server is down.
DB server doesn't accept TCP/IP connections.
DB server has run out of connections.
Something in between Java and DB is blocking connections, e.g. a firewall or proxy. 

To solve the one or the other, follow the following advices:

Verify and test them with ping.
Refresh DNS or use IP address in JDBC URL instead.
Verify it based on my.cnf of MySQL DB.
Start the DB.
Verify if mysqld is started without the --skip-networking option.
Restart the DB and fix your code accordingly that it closes connections in finally.
Disable firewall and/or configure firewall/proxy to allow/forward the port. 
------解决方案--------------------
你的数据库建在哪里?是建在sae上吗?