1. Start jetty with the agent.


 java -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=n -jar start.jar

This port (9999) will be the port that expose the VM to eclipse.

2. It will start like this :

It must start with something like “Listening for transport dt_socket at address: 9999” if the remote agent started successfully.


namal@namal:/rezsystem/aventura/jetty-distribution-9.2.6.v20141205$ java -Xdebug -agentlib:jdwp=transport=dt_socket,address=9999,server=y,suspend=n -jar start.jar
 Listening for transport dt_socket at address: 9999
 2015-02-07 19:14:33.756:INFO::main: Logging initialized @1139ms
 2015-02-07 19:14:33.983:WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended. See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html
 2015-02-07 19:14:34.214:INFO:oejs.Server:main: jetty-9.2.6.v20141205
 2015-02-07 19:14:34.241:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:/rezsystem/aventura/jetty-distribution-9.2.6.v20141205/webapps/] at interval 1
 2015-02-07 19:14:34.968:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@114a0de{/jsp,file:/rezsystem/aventura/jetty-distribution-9.2.6.v20141205/webapps/jsp/,AVAILABLE}{/jsp}
 2015-02-07 19:14:35.230:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@deaa44{/test-java,file:/tmp/jetty-0.0.0.0-8080-test-java.war-_test-java-any-4585236154727991456.dir/webapp/,AVAILABLE}{/test-java.war}
 2015-02-07 19:14:35.567:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@b6b7e3{/Connectors,file:/tmp/jetty-0.0.0.0-8080-Connectors.war-_Connectors-any-1112909290356820486.dir/webapp/,AVAILABLE}{/Connectors.war}
 2015-02-07 19:14:35.830:INFO:oejsh.ContextHandler:main: Started o.e.j.w.WebAppContext@55de3b{/LoginExample,file:/tmp/jetty-0.0.0.0-8080-LoginExample.war-_LoginExample-any-1704502924819382641.dir/webapp/,AVAILABLE}{/LoginExample.war}
 2015-02-07 19:14:35.880:INFO:oejs.ServerConnector:main: Started ServerConnector@db16d7{HTTP/1.1}{0.0.0.0:8080}
 2015-02-07 19:14:35.880:INFO:oejs.Server:main: Started @3263ms

3. Start Remote Debug

[Run] Debug As > [Debug Configurations…]

debug01

[Remote Java Application] > TestClassName
[Connect]

  • Project – This will be mentioned to initiate the debug points. It will not link with a particular project, but with the entire eclipse. it will ask for the particular project if the source couldn’t be located successfully.
  • Host – This may be a localhost or a remote IP
  • Port – This is the port that the VM agent was configured.

[Debug]

debug_2

4. Launch the Java application.

5. Trouble shooting and improvements.

If the eclipse can’t list the source for the remotely executing class, it will ask you to select the source. You can mention it using the Attaching the source as a Java Project or a relevant other option.

References :

Advertisements