JPDA: Java platform debugging architecture (Common Remote debugging methods)

Source: Internet
Author: User

Recently, the WTP Server feature is quite uncomfortable. When the Tomcat server is connected, the server needs to be restarted for any changes in the Java class. In an angry moment, the JPDA is used. The following are some summary.

What is JPDA?
Java platform debugger architecture (JPDA: Java platform debugging architecture) consists of the Java Virtual Machine backend and the debugging platform front-end.
1. Java virtual machine provides Java debugging Functions
2. the debugging platform uses the debugging interaction protocol to request services from the Java Virtual MachineProgramDebugging

JPDA Architecture
JPDA implements the preceding descriptions through two interfaces and Protocols: jvmti (Java Virtual Machine Tool Interface), jdwp (Java debugging connection protocol), and jdi (Java debugging interface ).
1. jvmti defines the debugging service that the virtual machine should provide, including debugging information (such as stack information) and debugging behavior (such as setting a breakpoint on the client) and notification (such as notifying the client when a breakpoint is reached), this interface is provided by the Virtual Machine implementer and combined in the Virtual Machine
2. jdwp defines the communication between the debugging service and the debugger, including defining the debugging information format and debugging request mechanism.
3. at the language level, jdi defines the debugging interfaces that can be used by the debugger to facilitate interaction with remote debugging services. This is implemented in Java, the debugger implementer can directly use this interface to access the Virtual Machine debugging service.

Running Mode
When the debugging service of a virtual machine is running, the virtual machine monitors a connection as the debugging service provider, and the debugger interacts with the virtual machine through the connection. Currently, the JVM on Windows provides two methods of connection: Shared Memory and socket connection. The shared memory service provider and debugging end can only be on the same machine, socket connection supports remote debugging on different devices.

virtual machine parameter settings
1. enable the debugging service
-xdebug enable debugging
-xrunjdwp: reference implementation library for loading JPDA of JVM
2. xrunjdwp sub-Parameters Configuration
the configuration format of xrunjdwp sub-parameters is as follows
-xrunjdwp: [= ], [= ]...

example
-xrunjdwp: Transport = dt_socket, Server = Y, address = 8000
listen to socket connection on port 8000, suspend the VM and do not load and run the main function until the debugging request arrives
-xrunjdwp: Transport = dt_shmem, Server = Y, suspend = n
select an available shared memory (because address is not specified), listen to the memory connection, and load and run the main function
-xrunjdwp: Transport = dt_socket, address = myhost: 8000
connect to the debugging service provided by myhost: 8000 (Server = n to debug the client ), suspend the VM and do not load and run the main function
-xrunjdwp: Transport = dt_shmem, address = mysharedmemory
connect to the debugging service by means of shared memory, hangs the VM and does not load and run the main function
-xrunjdwp: Transport = dt_socket, Server = Y, address = 8000,
onthrow = Java. io. ioexception, launch =/usr/local/bin/debugstub
wait for Java. io. ioexception is thrown, then the VM is suspended and listening to port 8000 connections. After receiving the debugging request, run the command/usr/local/bin/debugstub dt_socket myhost: 8000.
-xrunjdwp: transport = dt_shmem, Server = Y, onuncaught = Y, launch = D:/bin/debustub.exe
waits for a runtimeexception to be thrown, then suspends the VM and listens to an available shared memory, after receiving the debugging request, run the command D:/bin/debustub.exe dt_shmem

. The memory is available

.

Start Tomcat
-Xdebug-xrunjdwp: Transport = % jpda_transport %, address = % jpda_address %, Server = Y, suspend = N

The above two rows are Catalina of tomcat5.5.12. in the BAT file, we can see how Tomcat is started in the JPDA mode. To start Tomcat, we must start it with Catalina JPDA start, rather than startup. bat starts. Set jpda_transport and jpda_address before startup.

Another articleArticleHttp://www.blogcn.com/u2/38/21/ayufox/blog/36956440.html describes how to build a test platform using eclipse

Source: http://www.javaeye.com/topic/75128

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.