The 1099 port problem encountered by intellij idea deploying ssm/web projects to remote tomcat

In the past, MyEclipse was used for JavaEE projects, but due to the fluency of the IDE and the difficulty of code refactoring (you will know after using it, especially for the renaming of classes and variables), I decided to switch to IntelliJ IDEA, if you also want to change, it is not very difficult to get started. For students, it provides a free package that is reviewed once a year, the Ultimate version of the full package, and officially asks for piracy.

Okay, let’s get to the point, students who have used eclipse (Java EE version) and myeclipse all know that the release project is actually exported as a war package and directly transferred to the webapp to refresh, but IntelliJ is too troublesome to export the war package, so, Idea provides a more convenient way to directly configure tomcat to the remote server, and "a little" configuration on intellij can be directly published to the remote tomcat server.


To configure remote publishing, please go to https://segmentfault.com/a/1190000012762629

The blogger of the blog above wrote it in great detail, here is a call for the blogger! ! !


But there are still problems with this tutorial. After rummaging through the tutorials of major forums, coupled with my own experience analysis, I finally successfully released the ssm project to the remote server of the blogger Alibaba Cloud.

After the detailed study, the following questions are summarized:

1. Port 1099 is occupied when Catalina is started

2, 1099 port connection timeout


The operating environment of the blogger is:

IntelliJ IDEA:2018.1

Tomcat: Alibaba Cloud Remote Tomcat

System: CentOS


solution:


1. The port is occupied:

Execute the following command:

netstat -tln | grep 1099

will get the port usage

re-execute

lsof -i:1099

(command not found execute yum install lsof)

will get the program using the port

Find the corresponding PID

implement

kill -9 PID


2. Port connection timeout

I also searched a lot of tutorials on the Internet, but there are more or less problems. Either the connection is unsuccessful or the connection times out. The fundamental problem lies in port 1099. The most typical problem is

Error running 'TomcatRemote': 

Unable to connect to the xx.xx.xx.xx:1099, 

reason:

 java.rmi.ConnectException: Connection refused to host: xx.xx.xx.xx; 

nested exception is: java.net.ConnectException: Connection timed out: connect

The root cause of this error is that there is a problem with the configuration of the server, and jmx did not start successfully.

The solution is to add the following code to the catalina.sh file:

JAVA_OPTS="-Dcom.sun.management.jmxremote=
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.rmi.port=1099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Djava.rmi.server.hostname="

JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005"

export JAVA_OPTS

to the following location:


In the past, the startup method used by tomcat was ./start.sh

And now using caatalina.sh, you need to start with catalina, the specific command is as follows

./catalina.sh run

However, if it is started in this way, the current terminal will be blocked, and the background operation cannot continue after closing the terminal.

So the command is changed to:

catalina.sh run > /dev/null 2>&1 &

Where " > /dev/null 2>&1 &" is a command in Linux: put standard output and error handling in the recycle bin, so as to avoid a lot of output occupying your screen. 


The above are the most common problems that IntelliJ encounters when publishing to remote Tomcat. If you have any other questions, please contact [email protected].


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324642329&siteId=291194637