The project is deployed in a local server to start or debug, or to deploy the project on a remote server. In general, if you build a server locally, you can directly choose to start or direct debug, but if
How do we debug a project when it is deployed on a remote server? Some large companies do not need to build the application server locally, in order to unify the environment, the application server is on the remote server, this time
We need to debug with remote debug via the remote server's IP address and the remote open debug port:
1. First put the code that needs debugging on the remote server inside the IDE
2. In the menu bar, select Run->edit configuration, click on the + sign, select Remote, and then in the configuration item, enter the IP address and port number of the machine to be debugged remotely, and finally enter the project of the remote debugging at the top.
Name, make it easy for you to distinguish different items
3. Restart the remote Tomcat server by adding the-xdebug-xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5080 in the configuration item to the properties of the Java_opts
3. Select the menu bar Run button again to find debug+ "name of the project you set", click and then you can debug the remote debug
4. Set a breakpoint in the local project, then access the IP and port on the remote machine, and then debug on the local debug
Win system, in Catalina.bat:
SET Catalina_opts=-server-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket,server=y,suspend=n, address=8899
Linux systems, in catalina.sh:
Catalina_opts= "-server-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket,server=y,suspend=n, address=8899 "
Catalina_optsvsjava_opts
Two variables were applied to the start-stop script in Tomcat's catalina.sh or Catalina.bat files: catalina_opts and java_opts. Used to save the various parameters required for Tomcat to run.
Their comments in the file are as follows:
(optional) run-time parameters used by Java to execute "start", "Stop" or "Run" command; [java_opts]
(optional) run-time parameters used by Java to execute "start" or "Run" commands; [catalina_opts]
So why there are two different variables. What difference they have.
First, the parameters defined in both variables are passed to the command that launches Tomcat: "Start" and "Run", and only the parameters defined in Java_opts are passed to the "stop" command.
So defining a parameter to which variable does not affect Tomcat's start-up and operation only affects the end of Tomcat's run.
The second difference is more subtle. Other applications can also use java_opts, but Tomcat will only use catalina_opts. So if you only use Tomcat, when setting the environment variable, you'd better use
Catalina_opts, and if you also use other Java applications such as JBoss, you should use java_opts when setting up environment variables.
Attach my Tomcat configuration Catalina configuration:
Windows:
Set Catalina_home=d:/software/tomcat/mainapp_tomcat
Set catalina_base=%catalina_home%
Set Java_home=c:/program files/java/jdk1.8.0_144
Set Lctemp=%catalina_home%/logs
Set Local_dev_properties=%catalina_home%/conf/conf.properties
Set Lc_log_dir=%catalina_home%/logs
Set Lc_db_jndi_name=java:comp/env/jdbc/slpool
Set Dr_main_db_jndi_name=java:comp/env/mysql/drmain
Set CMC_DB_JNDI_NAME=JAVA:/COMP/ENV/MYSQL/DRCMC
Set Wm_db_jndi_name=java:comp/env/jdbc/wmpool
Set Wm_db_session_name=wmpool_tomcat
Set wm_db_username=****
Set wm_db_password=****
Set dr_cfg_zookeeper_env_url=***,***,***
Set Use_local_cookie_domain_name=true
set Java_opts=-server-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket,server=y,suspend=n, Address=8899-dfile.encoding=utf-8-xms512m-xmx1024m-xx:maxnewsize=256m-xx:+heapdumponoutofmemoryerror
Set java_opts=%java_opts%-dcom.sun.management.jmxremote.port=1090-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=false
Set java_opts=%java_opts%-dlc_session_config=meta-inf/sessions.xml
Set java_opts=%java_opts%-dlc_db_session_name=sl_demo_tomcat
Set java_opts=%java_opts%-dlc_db_jndi_name=java:/comp/env/jdbc/slpool
Set java_opts=%java_opts%-dlc.cfg.0=sysprop
Set java_opts=%java_opts%-dlc.cfg.1=db:base
Set java_opts=%java_opts%-dlc.cfg.2=db:sinodemo
Set java_opts=%java_opts%-dlc.cfg.3=sysprop
Set java_opts=%java_opts%-dlc.cfg.4=fileprop:%local_dev_properties%
Set java_opts=%java_opts%-dlc_dir_data_ext=%catalina_home%/webapps/root/extdata
Set java_opts=%java_opts%-dwm.cfg.0=sysprop
Set java_opts=%java_opts%-dwm.cfg.1=db:base
Set java_opts=%java_opts%-dwm.cfg.2=sysprop
Set java_opts=%java_opts%-dwm.cfg.3=fileprop:%local_dev_properties%
Set java_opts=%java_opts%-dwm_log_dir=%catalina_home%/logs
Set java_opts=%java_opts%-dwm_db_session_name=wmpool_tomcat
Set java_opts=%java_opts%-ddr_cfg_zookeeper_env_url=***,***,***
Set java_opts=%java_opts%-dlc_log_dir=%lc_log_dir%
Set java_opts=%java_opts%-DCMC_DB_JNDI_NAME=JAVA:/COMP/ENV/MYSQL/DRCMC
Linux:
Export Catalina_home=/arcdevelop/developtools/tomcats/mainapp_tomcat
Export Catalina_base=${catalina_home}
Export Java_home=/library/java/javavirtualmachines/jdk1.8.0_112.jdk/contents/home
Export Lctemp=${catalina_home}/logs
Export Local_dev_properties=${catalina_home}/conf/conf.properties
Export Lc_log_dir=${catalina_home}/logs
Export Lc_db_jndi_name=java:comp/env/jdbc/slpool
Export Dr_main_db_jndi_name=java:comp/env/mysql/drmain
Export CMC_DB_JNDI_NAME=JAVA:/COMP/ENV/MYSQL/DRCMC
Export Wm_db_jndi_name=java:comp/env/jdbc/wmpool
Export Wm_db_session_name=wmpool_tomcat
Export wm_db_username=****
Export wm_db_password=****
Export dr_cfg_zookeeper_env_url=***,***,***
Export Use_local_cookie_domain_name=true
export java_opts= "${java_opts}-server-xdebug-xnoagent-djava.compiler=none-xrunjdwp:transport=dt_socket, Server=y,suspend=n,address=8899-dfile.encoding=\ "Utf-8\"-xms512m-xmx1024m-xx:permsize=256m-xx:maxnewsize=256m- Xx:maxpermsize=256m-xx:+heapdumponoutofmemoryerror "
Export java_opts= "${java_opts}-dcom.sun.management.jmxremote.port=1090-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=false "
Export java_opts= "${java_opts}-dlc_session_config=meta-inf/sessions.xml"
Export java_opts= "${java_opts}-dlc_db_session_name=sl_demo_tomcat"
Export java_opts= "${java_opts}-dlc_db_jndi_name=java:/comp/env/jdbc/slpool"
Export java_opts= "${java_opts}-dlc.cfg.0=sysprop"
Export java_opts= "${java_opts}-dlc.cfg.1=db:base"
Export java_opts= "${java_opts}-dlc.cfg.2=db:sinodemo"
Export java_opts= "${java_opts}-dlc.cfg.3=sysprop"
Export java_opts= "${java_opts}-dlc.cfg.4=fileprop:${local_dev_properties}"
Export java_opts= "${java_opts}-dlc_dir_data_ext=${catalina_home}/webapps/root/extdata"
Export java_opts= "${java_opts}-dwm.cfg.0=sysprop"
Export java_opts= "${java_opts}-dwm.cfg.1=db:base"
Export java_opts= "${java_opts}-dwm.cfg.2=sysprop"
Export java_opts= "${java_opts}-dwm.cfg.3=fileprop:${local_dev_properties}"
Export java_opts= "${java_opts}-dwm_log_dir=${catalina_home}/logs"
Export java_opts= "${java_opts}-dwm_db_session_name=wmpool_tomcat"
Export java_opts= "${java_opts}-ddr_cfg_zookeeper_env_url=***,***,***
Export java_opts= "${java_opts}-dlc_log_dir=${lc_log_dir}"
Export java_opts= "${java_opts}-DCMC_DB_JNDI_NAME=JAVA:/COMP/ENV/MYSQL/DRCMC"