Idea remote debugging Tomcat web App

Source: Internet
Author: User

Recently doing a thing, the test environment and the local environment gap is too large, the local can run code, put in the test environment everywhere error, where not connected, so decided to deploy the code to the remote server debugging, save time.

Read a lot of tutorials on the internet, most of them are copied to each other, according to do not pass, so decided to send their own steps, but will not explain the details of these steps, need to understand the principle of the children's shoes please Baidu ...

Remote Environment: Debian 7, TOMCAT7, jdk1.8

Local: win7,tomcat7,jdk1.8,idea2017

The default JDK is all installed.

1. Remote Tomcat configuration:

Deployed in/home/your_username/apache-tomcat-7.0.82

    • Conf/server.xml

There are not many things to configure in this file.

<connector port="12345" protocol="http/1.1"                ConnectionTimeout="20000"               redirectport="  12346" /><!--  Here is if you do not want to use the default 8080 port to change to 12345 AJP something like that
    • bin/catalina.sh

This file adds three lines at the beginning:

Export catalina_opts="-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=12347 # #这个地方是jmx调试端口, need to correspond with idea, the following will explain-dcom.sun.management.jmxremote.ssl=false-dcom.sun.management.jmxremote.authenticate=false-djava.rmi.server.hostname=debian"Export Jpda_opts="-agentlib:jdwp=transport=dt_socket,address=56723,suspend=n,server=y"# #这里的address也要和idea里的对应Export Java_opts="-dcom.sun.management.jmxremote=-dcom.sun.management.jmxremote.port=12347 # #同上一个12347-dcom.sun.management.jmxremote.ssl=false-dcom.sun.management.jmxremote.authenticate=false-xdebug"

Then, start tomcat:bin/catalina.sh jpda start

Be careful not to start with another command

2.idea Related Configurations

    • First, local to have the same Tomcat version on the remote server
    • Second, the location of the browser is filled in with http://remote server port number
    • Third, the JMX port, the same port that is filled with catalina.sh
    • Four, staging way, I choose to upload to the remote Environment with SFTP, this way requires the remote server to open SSH and configure the SFTP service, here can be based on how convenient you. SFTP here after the host of the three point after the configuration is only used to fill the first tab, the back empty. Path from root is/apache-tomcat-7.0.82/webapps, mapped as is/home/your_username/apache-tomcat-7.0.82/webapps, Because when I set the host, the root is/home/your_username/.
    • At five, host is the remote hostname, and port is the port number previously defined in connector.
    • Finally, under before Launch tab, build artifact when you select War, do not select war exploded

3. Previously configured in the CATALINA.SH

Export jpda_opts=

This line, in fact, corresponds to the following part of idea:

OK, then you can break the point in the program and start debugging.

Idea remote debugging Tomcat web App

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.