1、linux系统环境信息
[root@softtest ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
[root@softtest home]# uname -a
Linux softtest 2.6.18-164.el5 #1 SMP Tue Aug 18 15:51:48 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
2、tomcat和JDK版本分别为
[root@softtest application]# ls -ld apache-tomcat-7.0.70
drwxr-xr-x 9 root root 4096 Aug 23 17:55 apache-tomcat-7.0.70
[root@softtest application]# ls -ld jdk1.7.0_79/
drwxr-xr-x 8 root root 4096 Apr 11 2015 jdk1.7.0_79/
#下述两个软连接如果仅用于测试,其实不必建立,我这是在测试环境部署,需要暂时这么搞而已。
#建立了apache-tomcat-7.0.70的软连接到/home目录。
[root@softtest home]# ls -l /home/tomcat_jycpsmis
lrwxrwxrwx 1 root root 33 Aug 23 17:57 /home/tomcat_jycpsmis -> /application/apache-tomcat-7.0.70
#建立了jdk1.7.0_79的软连接到/application目录。
[root@softtest application]# ls -l /application/jdk
lrwxrwxrwx 1 root root 25 Aug 23 17:51 /application/jdk -> /application/jdk1.7.0_79/
3、修改/home/tomcat_jycpsmis/bin目录下的catalina.sh文件。
#修改前记得备份
我在这个文件内容中的
# OS specific support. $var _must_ be set to either true or false.
上面加了如下内容,注意下面加的是软连接路径:
export JAVA_HOME=/application/jdk
export JRE_HOME=/application/jdk/jre
4、把war包通过rz -y命令上传到/home/tomcat_jycpsmis/webapps
5、启动对应tomcat并查看日志,例如日志内容为:
[root@softtest bin]# /bin/sh /home/tomcat_jycpsmis/bin/startup.sh >/dev/null 2>&1
[root@softtest jdk]# tailf /home/tomcat_jycpsmis/logs/catalina.out
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/7.0.70
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Jun 15 2016 16:27:45 UTC
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 7.0.70.0
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Linux
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 2.6.18-164.el5
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: /application/jdk1.7.0_79/jre
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.7.0_79-b15
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: /home/tomcat_jycpsmis
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: /home/tomcat_jycpsmis
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.config.file=/home/tomcat_jycpsmis/conf/logging.properties
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
Aug 23, 2016 6:15:16 PM org.apache.catalina.startup.VersionLoggerListener log
"/home/tomcat_jycpsmis/logs/catalina.out" 91L, 7183C 2,1 Top
INFO: Created system preferences directory in java.home.
Aug 23, 2016 6:15:22 PM java.util.prefs.FileSystemPreferences$6 run
WARNING: Prefs file removed in background /root/.java/.userPrefs/prefs.xml
Aug 23, 2016 6:15:22 PM java.util.prefs.FileSystemPreferences$6 run
WARNING: Prefs file removed in background /application/jdk1.7.0_79/jre/.systemPrefs/prefs.xml
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /application/apache-tomcat-7.0.70/webapps/jy-cps-mis has finished in 10,869 ms
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /application/apache-tomcat-7.0.70/webapps/examples
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /application/apache-tomcat-7.0.70/webapps/examples has finished in 203 ms
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /application/apache-tomcat-7.0.70/webapps/manager
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /application/apache-tomcat-7.0.70/webapps/manager has finished in 57 ms
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /application/apache-tomcat-7.0.70/webapps/ROOT
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /application/apache-tomcat-7.0.70/webapps/ROOT has finished in 46 ms
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /application/apache-tomcat-7.0.70/webapps/docs
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory /application/apache-tomcat-7.0.70/webapps/docs has finished in 46 ms
Aug 23, 2016 6:15:28 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8888"]
Aug 23, 2016 6:15:28 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Aug 23, 2016 6:15:28 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11842 ms
本文出自 “你可以选择不平凡” 博客,请务必保留此出处http://ylcodes01.blog.51cto.com/5607366/1841639
linux下部署tomcat指定JDK版本编译并运行javaWEB应用
原文地址:http://ylcodes01.blog.51cto.com/5607366/1841639