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 6096723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:57:39+00:00 2026-05-23T12:57:39+00:00

I have an application with embedded Jetty 6.1.26. Servlet 2.5. Below is my server

  • 0

I have an application with embedded Jetty 6.1.26. Servlet 2.5.
Below is my server configuration.

The problem is, that when I try to have JSPs and Servlets together, it does not work. I either have one or the other working, based on whether I have server.addHandler() or server.setHandler() in the code below.

By “does not work” I mean that Jetty returns 404, but otherwise it looks fine, even Jetty log shows the configuration went fine – see http://pastebin.com/PzbEx0qc (that was with addHandler(), JSP was not working).

The URLS requested are
http://localhost:17283/jars?mvnPath=… and
http://localhost:17283/jsp/index.jsp .

Thanks,
Ondra

Server server = new Server( PORT );
Context ctx = new Context( server, "/", Context.NO_SECURITY | Context.SESSIONS );


final String WEBAPP_RESOURCES_PATH = "org/jboss/qa/mavenhoe/web/jsp";
final String JSP_CONTEXT_PATH = "/jsp";

// For localhost:port/jsp/index.html and whatever else is in the directory...
final URL warUrl = this.getClass().getClassLoader().getResource(WEBAPP_RESOURCES_PATH);
final String warUrlString = warUrl.toExternalForm();
    WebAppContext webAppContext = new WebAppContext(warUrlString, JSP_CONTEXT_PATH);
webAppContext.setAttribute("jarIndex", jarIndex);
server.addHandler( webAppContext );


// .jar's download.
final ServletHolder mavenhoeSH = new ServletHolder(new JarFinderServlet(this.jarIndex));
ctx.addServlet( mavenhoeSH, "/jars" );


final ServletHolder shutdownSH = new ServletHolder(new JettyShutdownServlet( server ));
shutdownSH.checkServletType();
ctx.addServlet( shutdownSH, "/shutdown" );
  • 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-23T12:57:39+00:00Added an answer on May 23, 2026 at 12:57 pm

    Each path component should be handled by its own context and make sure you use ContextHandlerCollection for multiple contexts.

    ContextHandlerCollection contexts = new ContextHandlerCollection();
    
    contexts.setHandlers(new Handler[] { jspContext, servletContext });
    
    server.setHandler(contexts);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a spring application that uses an embedded Jetty instance. Since I am
I have an application (Gtk) that has an embedded server (using circuits). Both components
How does one compares to the other? I have an embedded application that if
I have an application that has Powershell 1 embedded into it, but we need
In an embedded application, we have a table describing the various address ranges that
I have an application in C# (2.0 running on XP embedded) that is communicating
I have an application that prints by generating text files with embedded printer codes,
I have an application that sends an HTML formatted email with embedded images. The
I have an application on the Compact Framework that has some large embedded resources
I have an single threaded, embedded application that allocates and deallocates lots and lots

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.