当前位置:首页 > 操作系统 > Linux

Linux 环境下用Tomcat 发布项目

 

<SPAN style=‘font-family: "courier new", courier;‘>1、前提条件:


<SPAN style=‘font-family: "courier new", courier;‘>a、安装远程连接Linux软件:F-Secure SSH File Transfer Trial【简写为:FSSH】;


<SPAN style=‘font-family: "courier new", courier;‘>b、打开FSSH,远程连接Linux【单击“Quick Connect”按钮,需要输入Linux的IP和登陆密码】,

<SPAN style=‘font-family: "courier new", courier;‘>   在Linux上先安装好JDK环境;

 

<SPAN style=‘font-family: "courier new", courier;‘>2、将Tomcat和WEB02放置在Linux服务器:

<SPAN style=‘font-family: "courier new", courier;‘>   打开FSSH,远程连接Linux【单击“Quick Connect”按钮,需要输入Linux的IP和登陆密码】;

<SPAN style=‘font-family: "courier new", courier;‘>   将Tomcat和WEB02文件夹放置在目录 :/home/weblogic 下。

 

<SPAN style=‘font-family: "courier new", courier;‘>3、修改项目文件:

<SPAN style=‘font-family: "courier new", courier;‘>   将WEB02文件夹改成WEB03;在 /home/weblogic/WEB03/WEB-INF/classes 下,修改

<SPAN style=‘font-family: "courier new", courier;‘>   CpGpsConfig.ini 文件,将里面的mqNameWeb=WEB02 和 webSn=2 分别改成:

<SPAN style=‘font-family: "courier new", courier;‘>   mqNameWeb=WEB03 , webSn=3;

 

<SPAN style=‘font-family: "courier new", courier;‘>4、修改(或添加)Tomcat 的server.xml文件:

<SPAN style=‘font-family: "courier new", courier;‘>    在目录 /home/weblogic/apache-tomcat-6.0.18/conf 下修改server.xml 文件:

<SPAN style=‘line-height: 1.5; font-family: "courier new", courier;‘>将docBase改成:docBase="/home/weblogic/WEB03/" (项目文件WEB03放置位置):

        <
        Context 
        path
        ="/cpgps"
         docBase
        ="/Xmove/XmoveComm5.5/WEB03/"
         privileged
        ="true"
         antiResourceLocking
        ="false"
         antiJARLocking
        ="false"
        >
        <
        Resource 
        name
        ="GPS_DataSource"
         auth
        ="Container"
         type
        ="javax.sql.DataSource"
        

        username
        ="lngps"
         password
        ="lngps"
         driverClassName
        ="oracle.jdbc.driver.OracleDriver"
        

        url
        ="jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 200.200.200.72)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)

        (HOST = 200.200.200.82)(PORT = 1521))(LOAD_BALANCE = yes)(CONNECT_DATA =(SERVICE_NAME = gpsrac)(FAILOVER_MODE =(TYPE = SELECT)             (METHOD = BASIC)(RETRIES = 180)(DELAY = 5))))"
        >
        </
        Resource
        >
        </
        Context
        >
    

 

<SPAN style=‘font-family: "courier new", courier;‘>5、新建 catalina.out 文件:

<SPAN style=‘font-family: "courier new", courier;‘>    在 /home/weblogic/apache-tomcat-6.0.18/logs目录下新建 catalina.out 文件,用于显示控制台输出;

<SPAN style=‘font-family: "courier new", courier;‘>启动前执行 echo > ../logs/catalina.out 命令清空 catalina.out 文件。

 

<SPAN style=‘font-family: "courier new", courier;‘>6、启动Tomcat :

<SPAN style=‘font-family: "courier new", courier;‘>    在目录: /home/weblogic/apache-tomcat-6.0.18/bin 下,找到Tomcat启动文件:<SPAN style=‘font-family: "courier new", courier;‘>Sartup.sh 

<SPAN style=‘font-family: "courier new", courier;‘>    在命令行输入: cd /home/weblogic/apache-tomcat-6.0.18/bin

<SPAN style=‘font-family: "courier new", courier;‘>    再输入启动命令: nohup sh ./startup.sh &

 

<SPAN style=‘font-family: "courier new", courier;‘>(1).启动注意事项:

<SPAN style=‘font-family: "courier new", courier;‘>    解决Mac OS lion下(ubuntu等linux也一样)启动tomcat的 Cannot find ./catalina.sh 的问题  :

<SPAN style=‘font-family: "courier new", courier;‘>从终端进入tomcat的bin目录,然后执行 startup.sh

<SPAN style=‘font-family: "courier new", courier;‘>bogon:~ apple$ cd /Users/apple/Desktop/tomcat_war/apache-tomcat-7.0.42/bin

<SPAN style=‘font-family: "courier new", courier;‘>bogon:bin apple$ sh startup.sh

<SPAN style=‘font-family: "courier new", courier;‘>输出结果为:

<SPAN style=‘font-family: "courier new", courier;‘>Cannot find ./catalina.sh

<SPAN style=‘font-family: "courier new", courier;‘>The file is absent or does not have execute permission

<SPAN style=‘font-family: "courier new", courier;‘>This file is needed to run this program

<SPAN style=‘font-family: "courier new", courier;‘>其实这里是权限, 

<SPAN style=‘font-family: "courier new", courier;‘>解决方法:

<SPAN style=‘font-family: "courier new", courier;‘>    依旧在tomcat 的bin目录下 

<SPAN style=‘font-family: "courier new", courier;‘>    执行 chmod +x *.sh  

<SPAN style=‘font-family: "courier new", courier;‘>    然后用 nohup sh ./startup.sh & 启动成功

<SPAN style=‘font-family: "courier new", courier;‘> 

<SPAN style=‘font-family: "courier new", courier;‘>7、需要用到的几个命令:

<SPAN style=‘font-family: "courier new", courier;‘>【技巧: 在命令行中输入一个文件的前几个字母,按“TAB”键会自动匹配】

 

<SPAN style=‘font-family: "courier new", courier;‘>强制退出当前会话: Ctrl + C 

<SPAN style=‘font-family: "courier new", courier;‘>查看启动后台输出【WebLogic】 : tail -f nohup.out 

<SPAN style=‘font-family: "courier new", courier;‘>查看启动后台输出【Tomcat】 : tail -f ../logs/catalina.out  

 

<SPAN style=‘font-family: "courier new", courier;‘>查看启动进程【WebLogic】 : ps -ef|grep  weblogic/tomcat

<SPAN style=‘font-family: "courier new", courier;‘>查看启动进程【Tomcat】 :ps -ef|grep  tomcat 

<SPAN style=‘font-family: "courier new", courier;‘>强制关闭进程: kill -9 进程号 

 

<SPAN style=‘font-family: "courier new", courier;‘>查看目录中所有文件: ls 

<SPAN style=‘font-family: "courier new", courier;‘>查看当前完整路径: pwd 

 

<SPAN style=‘font-family: "courier new", courier;‘>清空 catalina.out 文件:echo > ../logs/catalina.out 

<SPAN style=‘font-family: "courier new", courier;‘>清空 nohup.out文件: echo> nohup.out 

<SPAN style=‘font-family: "courier new", courier;‘>切换成root用户: su root    【口令:123456】

<SPAN style=‘font-family: "courier new", courier;‘> 

<SPAN style=‘font-family: "courier new", courier;‘>8、访问系统:

<SPAN style=‘font-family: "courier new", courier;‘>在浏览器上输入:200.200.200.17/cpgps 进入系统登录页面,登录系统;

原文:http://www.cnblogs.com/mingyue1818/p/3560639.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐