Upload
nichelle-brown
View
27
Download
4
Embed Size (px)
DESCRIPTION
Web Servers and Server-Side Debugging. Jetty. In this course we are using Maven Jetty Plugin for convenience Maven plugin configuration: To run Jetty execute from Maven Web project root: mvn jetty:run. org.mortbay.jetty - PowerPoint PPT Presentation
Citation preview
Web Servers andServer-Side Debugging
Jetty
• In this course we are using Maven Jetty Plugin for convenience
• Maven plugin configuration:
• To run Jetty execute from Maven Web project root:mvn jetty:run
<plugin><groupId>org.mortbay.jetty</groupId><artifactId>jetty-maven-plugin</artifactId><version>8.1.7.v20120910</version>
</plugin>
Enable remote debugging
• Set environment variable MAVEN_OPTS with value-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n
• E.g. create a BAT file for running Jetty:
set MAVEN_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=nmvn jetty:run
Debug configuration in Eclipse
> Run > Debug Configurations…
Debugging
1. Start Jetty
2. Launch Debug configuration in Eclipse
Debugging
3. Add breakpoint, e.g. in Servlet code and send HTTP request
4. Server will stop at breakpoint
Debugging
Tomcat
Download Tomcat
• Download the Apache Tomcathttp://tomcat.apache.org
• Un-zip the distribution file
• Deploy your application• Copy WAR file inside
<TOMCAT_HOME>\webapps
• Tomcat server can be started by executing BAT script <TOMCAT_HOME>\bin\startup.bat
Set up remote debugging
1. Stop Tomcat (Ctrl+C or close console window)
2. Open the startup script: startup.bat
3. Add the following lines at the first blank line in the file (around line 8)
set JPDA_ADDRESS=8787
set JPDA_TRANSPORT=dt_socket
4. Change the execute line at the end to include jpda startcall "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%
5. Run the startup script to run Tomcat in debug mode
http://confluence.sakaiproject.org/display/BOOT/Setting+Up+Tomcat+For+Remote+Debugging
JBoss
Download JBoss
• Download the JBoss application server
https://www.jboss.org/jbossas/downloads/
• Un-zip the distribution file
• Deploy your application• Copy WAR file inside
<JBOSS_HOME>\server\workspace\deploy
• JBoss server can be started by executing BAT script <JBOSS_HOME>\bin\run.bat
Enable remote debugging
1. Stop JBoss (Ctrl+C or close console window)
2. Add or un-comment the following line in run.bat
rem JPDA options. Uncomment and modify asrem appropriate to enable remote debugging.set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,
address=8787,server=y,suspend=n %JAVA_OPTS%
3. Create new “Remote Java Application” debug configuration in Eclipse:
Run Open Debug Dialog