Remote debugging used by IntellJ idea


In the test environment, you need to monitor the running status and debug operation of the system on the



remote Linux


//Add the address of the test environment to be accessed
http://xxx.xxx.com
//Configure the local host to point to the test environment
192.168.104.141 xxx.xxx.com
//Configure the address port of idea to be the same as your remote machine
host:192.168.104.141
port:8080

4 Find the startup/Connection and select debug to

copy -agentlib:jdwp=transport=dt_socket,address=22000,suspend=n,server=y and configure it to the JAVA_OPTS of the remote server and add -XDebug in front of
mine. Each project has its own Environment, if you are global, you can configure your corresponding JAVA_OPTS
#!/bin/bash
#chown 555 -R /export/home/tomcat/domains/
export CATALINA_HOME=/export/servers/tomcat6.0.33
export CATALINA_BASE=/export/Domains/air.insur.man.com/server1
###JAVA
export JAVA_HOME=/usr/lib/jvm/java-1.8.0
export JAVA_BIN=/usr/lib/jvm/java-1.8.0/bin
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/bin
export CLASSPATH=.:/lib/dt.jar:/lib/tools.jar
export  JAVA_OPTS="-Djava.library.path=/usr/local/lib -server -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -Djava.awt.headless=true -Dsun.net.client.defaultConnectTimeout=60000 -Dsun.net.client.defaultReadTimeout=60000 -Djmagick.systemclassloader=no -Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.ttl=300 -Xdebug -agentlib:jdwp=transport=dt_socket,address=22000,suspend=n,server=y"
export JAVA_HOME JAVA_BIN PATH CLASSPATH JAVA_OPTS
$CATALINA_HOME/bin/startup.sh -config $CATALINA_BASE/conf/server.xml

5. Run it to see if you can use debug directly.
6. The port error is reported when running, and the debugging port is changed to the server's port. If the error reported at startup is,
Error running reman_tomcat: Unable to open debugger port (192.168.104.141:22000): java.net.ConnectException "Connection refused: connect"

But your local has been started, this is to check whether the port of your server has an external port,
telnet 192.168.104.141:22000

If not, you need to open your remote monitoring port.
port out of range:80777 error prompt, check whether the remote port you set is wrong

Guess you like

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