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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:20:35+00:00 2026-05-11T08:20:35+00:00

I’m trying to get into Java web development but seem to be running into

  • 0

I’m trying to get into Java web development but seem to be running into a strange issue with Tomcat and an extremely simple servlet. The catalina log is spewing this every time I try and load the app:

Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name MyServlet     at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:2393)     at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:2373)     ... 40 more Mar 4, 2009 10:37:58 AM org.apache.catalina.startup.ContextConfig applicationWebConfig SEVERE: Parse error in application web.xml file at jndi:/localhost/mywebapp/WEB-INF/web.xml java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name MyServlet 

Makes decent sense. It can’t seem to find my servlet. However, the servlet seems to be in the right place. I can plainly see it at WEB-INF/classes/MyServlet.class

For reference, this is the web.xml file I’m currently using:

<?xml version='1.0' encoding='ISO-8859-1'?> <web-app xmlns='http://java.sun.com/xml/ns/javaee' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd' version='2.5'>      <description>My first web app in Java.</description>     <display-name>My Web App</display-name>      <servlet>         <servlet-name>MyServlet</servlet-name>         <servlet-class>MyServlet</servlet-class>     </servlet>      <servlet-mapping>         <servlet-name>MyServlet</servlet-name>         <url-pattern>/myservlet</url-pattern>     </servlet-mapping> </web-app> 

As you can see, I’m keeping things simple… but it continually throws this exception. What does a bare-bones web app look like in Java, which components am I missing?

Update

To make absolutely certain it wasn’t an artifact of some kind, I started up a fresh copy of Tomcat and tried again. Upon doing so, this started appearing in the log files:

SEVERE: Error deploying web application archive mywebapp.war java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class MyServlet) 

I dumped my .class file for the MyServlet class, rebuilt it with -target 1.5, repackaged the .war and everything worked perfectly.

Thank you so much for the help! A good lesson in troubleshooting never hurt anybody.

  • 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. 2026-05-11T08:20:35+00:00Added an answer on May 11, 2026 at 8:20 am

    Well, given the updated information, it appears that your problem is that the compiler you used for your class is potentially a newer version of the JDK than the one running Tomcat.

    Check the JDK version being used to start Tomcat, and then see if you can do something to reconcile the version differences between that and the one you’re using to compile your servlet with.

    That should clear up your issue.

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

Sidebar

Ask A Question

Stats

  • Questions 102k
  • Answers 102k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can add the sIFR-ignore class to elements you do… May 11, 2026 at 8:18 pm
  • Editorial Team
    Editorial Team added an answer Try ;-) rpc:call( Node, c, ls, [] ). or when… May 11, 2026 at 8:18 pm
  • Editorial Team
    Editorial Team added an answer There are at least two problems here which prevent you… May 11, 2026 at 8:18 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.