13
Web Servers and Server-Side Debugging

Web Servers and Server-Side Debugging

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

Page 1: Web Servers and Server-Side Debugging

Web Servers andServer-Side Debugging

Page 2: 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

<plugin><groupId>org.mortbay.jetty</groupId><artifactId>jetty-maven-plugin</artifactId><version>8.1.7.v20120910</version>

</plugin>

Page 3: Web Servers and Server-Side Debugging

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

Page 4: Web Servers and Server-Side Debugging

Debug configuration in Eclipse

> Run > Debug Configurations…

Page 5: Web Servers and Server-Side Debugging

Debugging

1. Start Jetty

2. Launch Debug configuration in Eclipse

Page 6: Web Servers and Server-Side Debugging

Debugging

3. Add breakpoint, e.g. in Servlet code and send HTTP request

4. Server will stop at breakpoint

Page 7: Web Servers and Server-Side Debugging

Debugging

Page 8: Web Servers and Server-Side Debugging

Tomcat

Page 9: Web Servers and Server-Side Debugging

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

Page 10: Web Servers and Server-Side Debugging

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

Page 11: Web Servers and Server-Side Debugging

JBoss

Page 12: Web Servers and Server-Side Debugging

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

Page 13: Web Servers and Server-Side Debugging

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