Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy my web application to jetty9 as root application?

Tags:

jetty

When I use jetty6, I use the following:

<Configure class="org.mortbay.jetty.webapp.WebAppContext">


  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <!-- Required minimal context configuration :                        -->
  <!--  + contextPath                                                  -->
  <!--  + war OR resourceBase                                          -->
  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
  <Set name="contextPath">/</Set>
  <Set name="resourceBase"><SystemProperty name="jetty.home" default="."/>/webapps/myapp</Set>

</Configure>

this file located in folder contexts,named myapp.xml

But switch to jetty 9, first there is no such folder "contexts", and I put myapp.xml into webapps just like test.xml, restart jetty and navigate to http://localhost:8080, the page remain the default one, not my application.

Can anybody give me a hint?

like image 800
Tom Avatar asked Apr 01 '13 15:04

Tom


People also ask

How do you deploy a jetty?

The standard way of deploying Jetty applications is copying a WAR file to $JETTY_HOME\webapps and letting Jetty's deployment scanner scan and automatically deploy the file. You can also customize application deployments in Jetty using the Jetty Deployable Descriptor XML File).

How do you deploy war in Jetty server?

Deploying by Copying WAR The easiest way to deploy a web application to Jetty server is probably by copying the WAR file into the $JETTY_HOME/webapps directory. Jetty will scan its $JETTY_HOME/webapps directory at startup for web applications to deploy. Our new app will be deployed at /jetty-app context.

What is Jetty base?

Jetty is an open-source project providing an HTTP server, HTTP client, and javax. servlet container.

What is jetty used for?

Jetties protect the shoreline of a body of water by acting as a barrier against erosion from currents, tides, and waves. Jetties can also be used to connect the land with deep water farther away from shore for the purposes of docking ships and unloading cargo. This type of jetty is called a pier.


1 Answers

In Jetty 6, if you had

${jetty.home}/contexts/myapp.xml

With Jetty 9.0, move it to

${jetty.home}/webapps/myapp.xml

With Jetty 9.1+, move it to

${jetty.base}/webapps/myapp.xml

Make sure the exploded webapp directory is the same name as your xml file to prevent double deployment.

You also need to change your Context XML File for Jetty 9.

<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
          "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/</Set>
  <Set name="war"><Property name="jetty.home" default="." />/webapps/myapp</Set>
</Configure>  

Or alternatively, just name your exploded webapp directory

${jetty.home}/webapps/ROOT

Documentation found:

http://www.eclipse.org/jetty/documentation/current/configuring-deployment.html

Updated for Jetty 9.1

like image 111
Joakim Erdfelt Avatar answered Oct 12 '22 17:10

Joakim Erdfelt