Deploy Tomcat, war package and the associated error troubleshooting Linux system

A, maven package being given to fight war

  • maven install or Pakage being given

1、Perhaps you are running on a JRE rather than a JDK?

To translate what you

也许您运行的是JRE而不是JDK

2, problem solving

  • What sense of it, that you are running with a JRE, JDK need to be replaced

Two, Linux deployment tomcat

1, you need to determine the version of tomcat

tomcat Tsinghua Mirror

2, wget command to download

  • Best to cdYehao find files into the desktop, download
 wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.53/bin/apache-tomcat-8.5.53.tar.gz 

3, move to the directory where you want to save the tomcat

  • I am here/usr/loacl/
mv apache-tomcat-8.5.53.tar.gz /usr/local/
 当然你可以先解压后移动

4, extract

tar -zxvf apache-tomcat-8.5.53.tar.gz

5, modify tomcat port (optional)

  • This step can be omitted, but after you touch off the port occupied, resulting in service to get up, still have to change
  • conf file in the folder tomcat directory, modify the server.xml parameters
  • vim conf/server.xml note: At this point I was already in the directory under the tomcatHere Insert Picture Description
  • Modify Connector port (originally 8080)
 <Connector port="9090" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
  • Modify Server port (originally 8005)
<Server port="9005" shutdown="SHUTDOWN">
  • Add Context node, the next step will be to use,This step is optional, But the encounter complex projects you may encounter some problems
<Context docBase="oeOperator" path="/" reloadable="true" privileged="true"/>

Figure: some said to <Host>nodes within, I let him outside, no problemMy name is oeOperator.war war
Here Insert Picture Description

Reloadable = "true", tomcat automatically detects application in the operating state of the WEB-INF / classes and WEB-INF / class files in the lib directory, if the monitoring to have class file has changed, the server automatically load new web application program, namely hot deployment

path: the name of the project after project start accessed
docBase: the actual placement of the path of the project, noting that a project name instead of a folder name at this level

6, try running tomcat

(1) run

  • I was already in the bin directory of tomcat
  • startup.sh
  • sh startup.sh
  • sh startup.sh|tail -f ../logs/catalina.out I recommend this because you can see the log

(2) In the browser enter: localhost: port number

  • Tomcat see page it means to be successful

7, deploy war package

  • The war bag on the tomcat directory webapps/, I do not write command, the runtime is automatically loaded tomcat
  • Add Context node reference Previous

8, run tomcat

(1) given loading war package

  • error in opening zip file
  • Your war deployment might be damaged, send it again

(2) View

  • IP:端口/war包名/
localhost:9090/oeOperator/

(3) turn off the firewall

  • If you want access to this computer from another computer, then this essential point
CentOS7 turn off the firewall (temporarily, restart recovery)
sudo systemctl stop firewalld.service
Firewall does not start automatically boot
sudo systemctl disable firewalld.service

(4) open the firewall

Firewall boot
sudo systemctl enable firewalld.service
Turn off the firewall
sudo systemctl start firewalld.service

(5) firewall related commands can view this article

https://baijiahao.baidu.com/s?id=1643819548168227060&wfr=spider&for=pc

Published 59 original articles · won praise 6 · views 10000 +

Guess you like

Origin blog.csdn.net/qq_27009225/article/details/105166396