Hot deployment of a simple application at the pier

I am working with Jetty Hightide vesion 7 currently as a standalone server. I have a simple web project with several jsp and backing classes that I am currently deploying in an unexploded war in the JETTY_HOME / webapps directory.

Currently, the berth easily picks up any static jsp / html changes. If I understand correctly, can I configure my application so that the berth takes any class changes without restarting the server? I currently have in my jetty-web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <!-- This is the jetty specific web application configuration file. When starting a Web Application, the WEB-INF/web-jetty.xml file is looked for and if found, treated as a org.eclipse.jetty.server.server.xml.XmlConfiguration file and is applied to the org.eclipse.jetty.servlet.WebApplicationContext objet --> <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Call class="org.eclipse.jetty.util.log.Log" name="debug"> <Arg>executing jetty-web.xml</Arg> </Call> <Set name="contextPath">/SimpleDynamicProject</Set> </Configure> 

I also created SimpleDynamicProject.xml and placed it in JETTY_HOME / contexts. This file contains:

 <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> <!-- This is the jetty specific web application configuration file. When starting a Web Application, the WEB-INF/web-jetty.xml file is looked for and if found, treated as a org.eclipse.jetty.server.server.xml.XmlConfiguration file and is applied to the org.eclipse.jetty.servlet.WebApplicationContext objet --> <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Set name="contextPath">/SimpleDynamicProject</Set> <Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/webapps/SimpleDynamicProject</Set> </Configure> 

I'm also not sure how to properly run Jetty in debug mode, which I read was also needed. I tried to start the server with:

 java -Xdebug -jar start.jar OPTIONS=Server,jsp 

and

 java -Ddebug -jar start.jar OPTIONS=Server,jsp 

This is the first time I have used a pier, but so far I really like it.

Thanks for the help.

+1
java java-ee jetty
source share
2 answers

If you want to use the maven pier plugin

  <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.25</version> <configuration> <scanIntervalSeconds>10</scanIntervalSeconds> <requestLog implementation="org.mortbay.jetty.NCSARequestLog"> <!-- This doesn't do anything for Jetty, but is a workaround for a Maven bug that prevents the requestLog from being set. --> <append>true</append> </requestLog> <webApp>${basedir}/out/war/Spring2_5_6_war.war</webApp> </configuration> </plugin> 
0
source share

You need to define a ContextDeployer with a nonzero scan interval:

 <Call name="addLifeCycle"> <Arg> <New class="org.mortbay.jetty.deployer.ContextDeployer"> <Set name="contexts"><Ref id="Contexts"/></Set> <Set name="configurationDir"><SystemProperty name="jetty.home" default="."/>/contexts</Set> <Set name="scanInterval">1</Set> </New> </Arg> </Call> 

Regarding debugging, I think you mean connecting a remote debugger using JPDA. To do this, you need to set the -agentlib:jdwp 1 option:

 -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 

Configure your IDE debugger to connect to the specified port.

1 if the target virtual machine is 5.0 or later, -agentlib:jdwp preferred over the -Xdebug and -Xrunjdwp , which are still supported.

+5
source share

All Articles