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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:43:45+00:00 2026-05-22T11:43:45+00:00

I have a simple WAR project managed by Maven. I have the servlet code

  • 0

I have a simple WAR project managed by Maven. I have the servlet code under src/main/java/* and all the static content (HTML, images, etc) under src/main/webapp. I can deploy the resulting WAR on our staging JBoss server and it works, but the round-trip to redeploy is painfully slow. I’d like to be able to test changes locally on an embedded Tomcat, but I’m having problems.

The servlet mapping is set up in src/main/resources/web.xml — I think it’s correct; the relevant part looks like

<servlet>
  <servlet-name>myServ</servlet-name>
  <servlet-class>my.pkg.MyServ</servlet-class>
</servlet>

<servlet-mapping>
  <servlet-name>myServ</servlet-name>
  <url-pattern>/ms</url-pattern>
</servlet-mapping>

Maven tells me it’s running at localhost:8080/myprojectname, and indeed when I go there I can see the static content. However, I’ve tried localhost:8080/myprojectname/ms as well as “localhost:8080/ms` — the former gives me a 404, and the latter a 0-byte response.

In short: where’s my active content? I see nothing on the console. It looks like Maven made a target/tomcat/logs but that’s empty. target/tomcat/webapps is empty too, and when I run mvn tomcat:run -X, I get a lot of debug output, including references to all my JAR dependencies, a classesDir property that points to target/classes (which is correct), but no mention anywhere of that URL pattern I set, nor the name of the Servlet class to invoke as a handler. I feel like I’m supposed to tell Maven or Tomcat how to find the web.xml, or maybe specify the URL mapping in another way…. in case you can’t tell, I’m new at this 😀

ETA: My setup looks an awful lot like this guy, though our problems appear to be different.

  • 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-22T11:43:46+00:00Added an answer on May 22, 2026 at 11:43 am

    Simpler than I thought: though the POM is set up to use src/main/resources/web.xml, that’s not the “right” place to put it. Moving it to src/main/webapp/META-INF made the servlet show up — which, of course, led to another dozen or so mistakes in the project settings, but that’s a story for another day.

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

Sidebar

Related Questions

I'm using netbeans 6.7.1 and I have a maven web project (war file). I'd
I have a simple.jar file that stay in c:/JAR. When i used maven war
I have a simple GWT project in Eclipse, it has a servlet that calls
I have a simple j2ee application: foo.ear - foo.war - foo.jar (ejb3 jar) I
In general, is it a best practice to have simple POJO Java classes implement
I'm just transitioning from .NET to JAVA and have to start JAVA project with
My (simple) war project builds fine using mvn:package at the command line, but fails
I currently have a project built with maven-archetype-webapp artifact. The default packaging for this
I have developed a simple Apache-Axis java web service using Eclipse IDE and now
I have configured a Maven build for a very small GWT project I'm having.

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.