How to remotely debug tomcat or WebLogic

Source: Internet
Author: User
Developers and implementers may often encounter such conversations:

Implementation Engineer: Where is the problem with the system? (Omitted words + Several Interfaces)
Development Engineer: No way. I have restored the entire environment, including databases, code, and middleware ......
Implementation Engineer: Weblogic is here, and you are there?
Development Engineer: I am using tomcat, but what is the difference between Tomcat and WebLogic? I don't know ......

Then there is no result, because our personal computers really cannot or cannot afford the heavy lifting of Weblogic or websphere.

What should we do? In fact, we can use the remote debugging method:

Configure remote debugging in three steps:
1. for Tomcat:
1. open Catalina. BAT and add:
Set catalina_opts =-server-xdebug-xnoagent-djava. compiler = none-xrunjdwp: Transport = dt_socket, Server = Y, suspend = N, address = 5555
2. Configure eclipse. For example, if the port is the same as the address above, it is 5555 ):

 
3. If tocat is up (note that it may be on another machine), click debug to perform the same debugging process as the local service.

2. WebLogic:
1. Open startweblogic. CMD and adjust the place where the Java command is executed:
% Java_home %/bin/Java % java_vm % mem_args % java_options %-dweblogic. name = % SERVER_NAME %-dweblogic. productionmodeenabled = % production_mode %-djava. security. policy = "% wl_home %/Server/lib/weblogic. policy "weblogic. server
Adjusted
@ REM org: % java_home %/bin/Java % java_vm % mem_args % java_options %-dweblogic. name = % SERVER_NAME %-dweblogic. productionmodeenabled = % production_mode %-djava. security. policy = "% wl_home %/Server/lib/weblogic. policy "weblogic. server
@ REM surport remote Debug:
Set java_debug =-xdebug-xnoagent-xrunjdwp: Transport = dt_socket, address = 4000, Server = Y, suspend = N
% Java_home %/bin/Java % java_vm % java_debug % mem_args % java_options %-dweblogic. name = % SERVER_NAME %-dweblogic. productionmodeenabled = % production_mode %-djava. security. policy = "% wl_home %/Server/lib/weblogic. policy "weblogic. server
2. Other configurations are similar to Tomcat, as shown below:

3. Similarly, if Weblogic is up (Note: In the above example, Weblogic is not on the local machine, but on another machine), click debug, you can perform the same debugging process as the local service, as shown below:

You may ask: Will such debugging affect the customer's use? Of course, this will be affected. If a breakpoint is set for hit, the entire application will be suspended. So how can we perform debugging as much as possible? Methods are still available:
1. If it is tomcat, copy a copy of Tomcat again, modify the port, and then debug it. At this time, the entire environment is similar and debugging is very convenient;
2. If Weblogic is used, you can create a new domain without interfering with each other;
3. If it is websphere, I have never tried it and leave it to everyone.

How does it work? Curious people will ask, in fact, jdwp (Java (TM) debug wire protocol). If you are interested, Google it.

 

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.