碰到问题过程如下
问题1:
tomcat启动良好,localhost:8080访问成功
但是访问扔到tomcat上的项目怎样都是404
解决思路如下:
1. 查找catalina.out,查看启动log
发现项目有被加载
启动./startup.sh时发现调用的jre为1.6!
Using CATALINA_BASE: /usr/local/tomcat7Using CATALINA_HOME: /usr/local/tomcat7Using CATALINA_TMPDIR: /usr/local/tomcat7/tempUsing JRE_HOME: /usr/java/jdk1.6.0_25/jreUsing CLASSPATH: /usr/local/tomcat7/bin/bootstrap.jar:/usr/local/tomcat7/bin/tomcat-juli.jar
项目需要的jdk是1.8并且linux上也已经安装良好
命令java -version显示如下
java version "1.8.0_111"Java(TM) SE Runtime Environment (build 1.8.0_111-b14)Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
而此时系统设置的环境变量 /etc/PRofile 也已经华丽的设置了
export JRE_HOME=/usr/java/jdk1.8.0_111/jre
则解决方法是:
tomcat启动调用的./startup.sh打开细看会发现它其实调用的是catalina.sh
那么直接粗暴的在catalina.sh第一行粗暴的添加命令
export JRE_HOME=/usr/java/jdk1.8.0_111/jre
保存退出即可
问题2:
依然是将war包扔到webapps下启动tomcat
catalina.out信息如下:
INFO: Deploying web application archive /usr/local/tomcat7/webapps/Map.warFeb 08, 2017 1:44:39 AM org.apache.catalina.startup.TldConfig executeINFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and jsp compilation time.Feb 08, 2017 1:44:40 AM org.apache.catalina.core.StandardContext startInternalSEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log fileFeb 08, 2017 1:44:40 AM org.apache.catalina.core.StandardContext startInternalSEVERE: Context [/Map] startup failed due to previous errorsFeb 08, 2017 1:44:40 AM org.apache.catalina.startup.HostConfig deployWAR
加载了倒霉蛋war包但是错误
则转战项目本身的log,在map_info.log中发现报错,无法找到配置文件
将配置文件拷贝到相应的路径下面,DONE
问题3:
报错信息如下(catalina.out)
Feb 09, 2017 12:23:31 AM org.apache.catalina.loader.WebappClassLoaderBase validateJarFileINFO: validateJarFile(/usr/local/tomcat7/webapps/*****/WEB-INF/lib/el-api-2.2.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
解决方案:
应该是el-api-2.2.jar与tomcat7中的lib里jar包冲突,删掉项目中的jar包(/WEB-INF/lib),然后重启tomcat
以上。
新闻热点
疑难解答