Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7067869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:15:13+00:00 2026-05-28T05:15:13+00:00

I am running a Java webapp (let’s call it mywebapp). Currently I access my

  • 0

I am running a Java webapp (let’s call it mywebapp).

Currently I access my page in this webapp by pointing locally to:

http://localhost:9000/mywebapp/mystuff

However, I need to access it using:

http://localhost:9000/mystuff

How can I do this? I’ve tried messing with some confs, but to no avail…

This is my current root.xml:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
    <Set name="contextPath">/root</Set>
    <Set name="war">
        <SystemProperty name="app.webapps.path"/>/mywebapp.war
    </Set>
</Configure>

Also tried:

<?xml version="1.0"  encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
<Configure class="org.mortbay.jetty.webapp.WebAppContext">
    <Set name="contextPath">/</Set>
    <Set name="war">
        <SystemProperty name="app.webapps.path"/>/mywebapp.war
    </Set>
</Configure>

I’m using Maven – not sure if that may be making the difference.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T05:15:13+00:00Added an answer on May 28, 2026 at 5:15 am

    In order to set your context path to "/" you’ll want to use a Context deployment.
    Note: You MUST specify a context path string for path spec mapping reasons. An empty context path string "" is only valid as a mapping result from requests to the context root. See Section 12.2 of the servlet spec)

    In Jetty 7.x, the context path assignment is handled by the AppProviders assigned to the DeploymentManager.

    By default, on the Jetty Distribution, both the WebAppProvider and ContextProvider are enabled. This is important to know later, as it will influence your decisions on where to put the mywebapp.war file.

    See the ${jetty.home}/start.ini file, and you’ll see that it contains both the references to etc/jetty-webapps.xml and etc/jetty-contexts.xml

    WebAppProvider’s role is to pay attention to the ${jetty.home}/webapps/ directory for any deployable applications (such as *.war) and deploy them onto a context of the same name as the filename. In other words ${jetty.home}/webapps/MyApp-2.4.war is deployed into the context "/MyApp-2.4". There is also the special “root.war” reserved word that will deploy into the context "/". While this is the easiest deployment mechanism, it sacrifices control over the deployment specifics.

    ContextProvider’s role is to pay attention to the ${jetty.home}/contexts/ directory for any jetty-xml formatted deployable contexts. This deployment mechanism gives you the maximum control over the deployment, the xml file can control anything that is ultimately resolved to a org.eclipse.jetty.server.handler.ContextHandler base class, of which WebAppContext (wars / servlets / etc) are part of.
    The most common use is to specify a WebAppContext based xml file, and control things such as what files and directories make up the web application, what temporary directory to use, and even what Context Path to use.

    What you’ll want to do is to is:

    1. Make sure your ContextProvider based deployments are enabled in the start.ini (make sure that etc/jetty-context.xml is present)
    2. Create a ${jetty.home}/contexts/mywebapp.xml that declares the <Set name="contextPath">/</Set> option.
    3. If you have the etc/jetty-webapps.xml present in your start.ini, do not put your mywebapp.war in ${jetty.home}/webapps as that will cause the WebAppProvider to also deploy the same webapp and confusing your deployment.

    Finally, you can see how this is done in the jetty distribution itself, just open the ${jetty.home}/contexts/test.xml and look around. You’ll see that it loads the ${jetty.home}/webapps/test.war via the ContextProvider’s use of the ${jetty.home}/contexts/test.xml into the "/" context path.

    Another note, look at the logs.

    2012-01-13 13:56:28.779:INFO:oejsh.ContextHandler:started o.e.j.w.WebAppContext{/,file:/tmp/jetty-0.0.0.0-8080-test.war-_-any-/webapp/},/home/joakim/code/jetty/distros/jetty-distribution-7.6.0.RC3/webapps/test.war

    That tells me that WebAppContext was

    • Started on {/, (the root Context Path)
    • Using the temp/work directory file:/tmp/jetty-0.0.0.0-8080-test.war-_-any-/webapp/
    • Using the web application specified in /home/joakim/code/jetty/distros/jetty-distribution-7.6.0.RC3/webapps/test.war.

    Update: clarifying the statement about the empty context path.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running a java webapp with a simple mvn jetty:run , using the latest
I've encountered a strange problem in a Grails webapp running under Grails: java.io.UnsupportedEncodingException is
I have a Tomcat 5.5 running which includes a Webapp with the Java Reporting
I've got a running java webapp, that I'm monitoring with visualVM . Here's the
I have a Java webapp running on Tomcat. At runtime, I create images files
In my Java EE 6-webapp (running on latest GlassFish 3.1), I'm using JSF2-ManagedBeans and
Let's say I have a Java webapp deployed on some Application Server with clustering
I'm using VisualVM from JDK 1.6.0_26 to profile a Java webapp running under Tomcat,
I have a Java webapp, running in Tomcat 6, that loads RSS feeds from
I have a Flex/BlazeDS webapp (pseudo content management system) with a Java backend running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.