Tomcat部署遇到的问题
项目服务端:Tomcat6.0.41
选用数据库:Mysql5.6.17
JDK环境:1.6.37
运行系统:Windows server 2008(64bit)
===========================================================
部署好Tomcat项目,运行startup.bat.提示错误(节选):
……
2014-8-20 15:59:13 org.apache.cxf.endpoint.ServerImpl initDestination
信息: Setting the server's publish address to be /pay
2014-8-20 15:59:13 org.apache.cxf.jaxrs.provider.ProviderFactory setDefaultProvider
信息: Problem with setting the default provider org.apache.cxf.jaxrs.provider.JSONProviderorg/codehaus/jettison/mapped/TypeConverter
2014-8-20 15:59:14 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2014-8-20 15:59:14 org.apache.catalina.core.StandardContext start
严重: Context [/xGameServer] startup failed due to previous errors
2014-8-20 15:59:14 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/xGameServer] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
2014-8-20 15:59:14 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/xGameServer] appears to have started a thread named [Thread-2] but has failed to stop it. This is very likely to create a memory leak.
2014-8-20 15:59:14 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/xGameServer] appears to have started a thread named [Thread-3] but has failed to stop it. This is very likely to create a memory leak.
2014-8-20 15:59:14 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/xGameServer] appears to have started a thread named [Thread-5] but has failed to stop it. This is very likely to create a memory leak.
2014-8-20 15:59:14 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
严重: The web application [/xGameServer] appears to have started a thread named [NioSocketAcceptor-1-idleStatusChecker] but has failed to stop it. This is very likely to create a memory leak.
……
===========================================================
在这里,需要吐槽tomcat的错误提示。因为它的错误提示很表面。单纯看这错误提示内容,红色部分内容,我们简单地理解为web项目启动了JDBC驱动程序,但是在web项目停止时,JDBC驱动程序注销失败。为了防止内存泄漏,该驱动程序被强制干掉了....然后就引发了后面一大片的蓝色部分内容:提示好多好多线程被启动了,吓唬你不关闭线程的话可能会导致程序内存泄漏(也就是可能会导致程序挂掉)。
这个时候,你需要这样一份文件(Tomcat不自带):
============================文件内容===============================
handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################
org.apache.juli.FileHandler.level = FINE
org.apache.juli.FileHandler.directory = ${catalina.base}/logs
org.apache.juli.FileHandler.prefix = error-debug.
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
============================文件内容===============================
新建一个记事本,将上面绿色字体内容C-V操作,然后保存文件为logging.properties
OK,完成。
将这份文件拷贝到部署项目目录的\WEB-INF\Classes目录下。
e.g.假设我的部署项目目录名为:HeHe
把文件放在:webapps\HeHe\WEB-INF\Classes\logging.properties
然后再次运行tomcat的startup.bat,界面显示的错误不变,我们要查看的是Tomcat根目录下的logs目录(例如:E:\tomcat6\logs),有一份文本文件:error-debug.xxxx-xx-xx
回到我们项目运行失败的问题上,从error-debug.xxxx-xx-xx文件中可以看到,最根本报错的地方是:
===========================================================
2014-8-20 16:25:46 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
2014-8-20 16:25:51 org.apache.cxf.endpoint.ServerImpl initDestination
信息: Setting the server's publish address to be /pay
2014-8-20 16:25:51 org.apache.cxf.jaxrs.provider.ProviderFactory setDefaultProvider
信息: Problem with setting the default provider org.apache.cxf.jaxrs.provider.JSONProviderorg/codehaus/jettison/mapped/TypeConverter
2014-8-20 16:25:52 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class com.linyun.xgame.listener.InitSystemListener
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [HY000]; error code [1130];
--- The error occurred in com/linyun/xgame/dao/sqlmap/Global.xml.
--- The error occurred while executing query.
--- Check the SELECT VALUE_INT AS valueInt, VALUE_STR AS valueStr,PRO_1 AS pro_1,PRO_2 AS pro_2,PRO_3 AS pro_3,PRO_4 AS pro_4,PRO_5 AS pro_5,PARA_ID AS paraID,PARA_DESC AS paraDesc,ISCLIENT AS isclient FROM T_GLOBAL .
--- Check the SQL Statement (preparation failed).
--- Cause: java.sql.SQLException: null, message from server: "Host 'iZ23e08c18sZ' is not allowed to connect to this MySQL server"; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in com/linyun/xgame/dao/sqlmap/Global.xml.
--- The error occurred while executing query.
--- Check the SELECT VALUE_INT AS valueInt, VALUE_STR AS valueStr,PRO_1 AS pro_1,PRO_2 AS pro_2,PRO_3 AS pro_3,PRO_4 AS pro_4,PRO_5 AS pro_5,PARA_ID AS paraID,PARA_DESC AS paraDesc,ISCLIENT AS isclient FROM T_GLOBAL .
--- Check the SQL Statement (preparation failed).
--- Cause: java.sql.SQLException: null, message from server: "Host 'iZ23e08c18sZ' is not allowed to connect to this MySQL server"
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
……
===========================================================
红色部分就把问题暴露出来了:数据库访问失败了...
访问数据库失败原因:Mysql默认是不可以通过远程机器访问的,所以我们需要开启远程访问。
解决方式(网上有提供其他方法,这里只说我选择的方式):
1.进入到Mysql控制台。运行-CMD,一直cd进入到Mysql的bin目录,输入:mysql -uroot -p
2.提示输入mysql的访问密码。
3.输入密码后输入:use mysql;(记得分号)
4.输入:show tables;
5.输入:select host from user;
6.输入:update user set host = '%' where user = 'root' and host = 'localhost';
OK。。。大功告成。。。如果执行命令没出错的话,再次运行startup.bat,这回就可以运行妥妥的。
Tomcat部署遇到的问题的更多相关文章
- Tomcat部署web项目,如何直接通过域名访问,不加项目名称
问题:下面的问题是互联网上问得比较多的,但是显然都是同一个问题. JavaWeb项目部署到tomcat服务之后设置不需要输入项目名称即可访问? Tomcat部署web项目,如何直接通过域名访问,不加项 ...
- Tomcat部署web应用程序
对Tomcat部署web应用的方式总结,常见的有以下四种: 1.[替换ROOT目录] 最简单的一种方法,webapps目录下面ROOT文件夹的文件为你的文件,然后输入localhost:8080/首页 ...
- 如何制定tomcat部署时自己定义的docBase路径
装了tomcat后发现tomcat安装在系统跟路径地下,每次部署的时候挺麻烦的,于是想指定一个自己定义的应用部署的路径: 以下是如何指定,相关文档请查看https://tomcat.apache.or ...
- Tomcat部署方式
tomcat中三种部署项目的方法 第一种方法:在tomcat中的conf目录中,在server.xml中的,<host/>节点中添加: <Context path="/he ...
- Tomcat 部署
<CATALINA_HOME>/webapps: Tomcat的主要Web发布目录,默认情况下把Web应用文件放于此目录. 1.war包部署: 将需要发布的web应用打成war文件, ( ...
- tomcat部署方法总结
可以参考之前的:http://www.cnblogs.com/youxin/archive/2013/01/18/2865814.html 在Tomcat中部署Java Web应用程序有两种方式:静态 ...
- 解决tomcat部署多个虚拟机时报IllegalStateException: Web app root system property already set to 的问题
解决tomcat部署多个虚拟机时报IllegalStateException: Web app root system property already set to 的问题 在web.xml中添加如 ...
- (转) Tomcat部署Web应用方法总结
原文:http://blog.csdn.net/yangxueyong/article/details/6130065 Tomcat部署Web应用方法总结 分类: Java web2011-01-11 ...
- Tomcat部署web应用的方式
对Tomcat部署web应用的方式总结,常见的有以下四种: 1.[使用控制台部署] 访问Http://localhost:8080,并通过Tomcat Manager登录,进入部署界面即可. 2.[利 ...
- Tomcat部署Web应用方法总结
转载:http://m.blog.csdn.net/blog/u012516903/15741727 Tomcat部署Web应用方法总结 在Tomcat中部署Java Web应用程序有两种方式:静态部 ...
随机推荐
- Ajax1
一.Ajax是什么? 全称"Asynchronous JavaScript and XML"(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术. AJA ...
- scrapy爬虫框架入门实例(一)
流程分析 抓取内容(百度贴吧:网络爬虫吧) 页面: http://tieba.baidu.com/f?kw=%E7%BD%91%E7%BB%9C%E7%88%AC%E8%99%AB&ie=ut ...
- nullcon HackIM 2016 -- Programming Question 5
Dont blink your Eyes, you might miss it. But the fatigue and exhaustion rules out any logic, any wil ...
- iframe高度调整
//设置iframe高度 function setHeight(){ var originalHeight=$(window).height(); var headerHeight=$('.heade ...
- 自动验证是ThinkPHP
自动验证是ThinkPHP模型层提供的一种数据验证方法,可以在使用create创建数据对象的时候自动进行数据验证. 数据验证有两种方式: 静态方式:在模型类里面通过$_validate属性定义验证规则 ...
- pandas中将timestamp转为datetime
参考自:http://stackoverflow.com/questions/35312981/using-pandas-to-datetime-with-timestamps 在pandas Dat ...
- linux提取指定字符的行列并生成新文件(awk命令)
如图所示,命名为file文件的表头有BP.A1.TEST等 假如想提取含有"ADD"的行和该行对应列的"BP"和"P"值,则需要用到以下命令 ...
- sql 将8位字符串转换成日期型
将8位字符串转换成日期型,方法如下: ),)
- Flask+Nginx+uWSGI在Ubuntu服务器上的配置
Flask+Nginx+uWSGI在Ubuntu服务器上的配置 Step1 安装系统环境 Ubuntu服务器选择是阿里云的ECS服务,ECS提供单独的内存\CPU\带宽\存储规格可以选择,并且提供合适 ...
- Spring 4 官方文档学习 Spring与Java EE技术的集成
本部分覆盖了以下内容: Chapter 28, Remoting and web services using Spring -- 使用Spring进行远程和web服务 Chapter 29, Ent ...