I have a maven based java web application running locally on the jetty server, I would like to debug the application.
Here are the steps I followed to make it happen.
- Enable server socket address (9999) at the server side.
- Enable Remote Java Application to bind to that address (9999).
1.Declare the maven-jetty-plugin on POM.xml as shown below.
<!-- Jetty server plugin --> <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.2.7.v20150116</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <webApp> <contextPath>/certifier</contextPath> </webApp> </configuration> </plugin>
2. click on Run As --> External Tool Configurations as shown below.
This will bring up another window as shown below. click new to create a new configuration !
* Location: The executable file of maven , (usr/bin/mvn is for ubuntu OS.)
* Working directory: The current project working directory.
* Arguments: jetty:run
3. Click on Environment Tab and add a new Environment Variable as shown below.
Now click Apply and Run to start the jetty server, also server will be listening on port 9999 for remote debugging.
4. Now click on Debug As --> Debug Configurations as shown below.
5. Click on Remote Java Application and click new to create a new configurations. This should bring up a new window as shown below.
Make sure to give the correct port,name, host etc. 6. Click on the common Tab to add this configuration to the favourite menu of Debug As.
Now you should be able to debug the application by placing few breakpoints in the java source code.