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

The Archive Base Latest Questions

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

I downloaded Eclipse for Java EE and Jetty 8.1 and would like to implement

  • 0

I downloaded Eclipse for Java EE and Jetty 8.1 and would like to implement a very simple Servlet.

Jetty works fine when I start it using java -jar start.jar.

To develop the Servlet I did this:

  1. In Eclipse, I choosed “New Dynamic Web Project”.

  2. I added jetty\lib\servlet-api-3.0.jar to the “Build Path” in Eclipse.

  3. In that project, “New Servlet”, and a Servlet was generated and I added some code:

    /**
     * Servlet implementation class MyServlet
     */
    @WebServlet("/MyServlet")
    public class MyServlet extends HttpServlet {
        private static final long serialVersionUID = 1L;
    
        /**
         * @see HttpServlet#doGet(HttpServletRequest request, 
                    HttpServletResponse response)
         */
        protected void doGet(HttpServletRequest request, 
                    HttpServletResponse response)
            throws ServletException, IOException {
            PrintWriter out = response.getWriter();
            out.println("<html><body><h1>My Servlet</h1></body></html>");
        }
    
        /**
         * @see HttpServlet#doPost(HttpServletRequest request, 
                    HttpServletResponse response)
         */
        protected void doPost(HttpServletRequest request, 
                    HttpServletResponse response)
            throws ServletException, IOException {
            // TODO Auto-generated method stub
        }
    
    }
    
  4. I created a file web.xml in WebContent\WEB-INF\web.xml with this content:

    <?xml version="1.0" encoding="utf-8" ?>
    <web-app 
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
    version="2.4">
    <servlet>
        <servlet-name>My Servlet</servlet-name>
    <servlet-class>MyServlet.class</servlet-class>
    </servlet>
    
    <servlet-mapping>
        <servlet-name>My Servlet</servlet-name>
        <url-pattern>/Servlet</url-pattern>
    </servlet-mapping>
    

  5. I copied the compiled .class-files in build\classes to WebContent\WEB-INF\classes

  6. Now I choose to Export the project as a .war-file to jetty\webapps\MySite.war.

  7. I start Jetty with java -jar start.jar and visit localhost:8080/MySite/Servlet but now I get this message:

    Servlet Not Initialized
    
    javax.servlet.UnavailableException: Servlet Not Initialized
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:546)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:485)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:483)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:412)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
    at org.eclipse.jetty.server.Server.handle(Server.java:351)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:451)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:916)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:647)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:233)
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:615)
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
    at java.lang.Thread.run(Thread.java:722)
    

and if I visit localhost:8080/MySite/ I see two folders WEB-INF\ and META-INF\ both with size 0 bytes.

So it doesn’t look like my .war-export in Eclipse worked.

How do I export my simple Servlet for Jetty using Eclipse?


I have now installed the Jetty WTP plugin for Eclipse, but I can’t run this servlet using it:

2012-01-30 10:06:50.322:INFO:oejs.Server:jetty-8.1.0.RC4
2012-01-30 10:06:50.353:INFO:oejdp.ScanningAppProvider:Deployment monitor C:\Users\Jonas\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps at interval 1
2012-01-30 10:06:50.353:INFO:oejdp.ScanningAppProvider:Deployment monitor C:\Users\Jonas\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\contexts at interval 1
2012-01-30 10:06:50.353:INFO:oejd.DeploymentManager:Deployable added: C:\Users\Jonas\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\contexts\MySite.xml
2012-01-30 10:06:50.650:WARN:oejuc.AbstractLifeCycle:FAILED o.e.j.w.WebAppContext{/MySite,file:/C:/Users/Jonas/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MySite/},C:\Users\Jonas\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0/wtpwebapps/MySite: java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
    at org.eclipse.jetty.annotations.AnnotationConfiguration.createAnnotationParser(AnnotationConfiguration.java:111)
    at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:73)
    at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:428)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1208)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:491)
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:138)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:142)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:53)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:332)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:118)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:552)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:227)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:58)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
    at org.eclipse.jetty.server.Server.doStart(Server.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1214)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1137)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:457)
    at org.eclipse.jetty.start.Main.start(Main.java:600)
    at org.eclipse.jetty.start.Main.main(Main.java:82)
Caused by: 
java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.jetty.annotations.AnnotationConfiguration.createAnnotationParser(AnnotationConfiguration.java:111)
    at org.eclipse.jetty.annotations.AnnotationConfiguration.configure(AnnotationConfiguration.java:73)
    at org.eclipse.jetty.webapp.WebAppContext.configure(WebAppContext.java:428)
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1208)
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:699)
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:454)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:36)
    at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:183)
    at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentManager.java:491)
    at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.java:138)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.fileAdded(ScanningAppProvider.java:142)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(ScanningAppProvider.java:53)
    at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:604)
    at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:535)
    at org.eclipse.jetty.util.Scanner.scan(Scanner.java:398)
    at org.eclipse.jetty.util.Scanner.doStart(Scanner.java:332)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(ScanningAppProvider.java:118)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(DeploymentManager.java:552)
    at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.java:227)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.util.component.AggregateLifeCycle.doStart(AggregateLifeCycle.java:58)
    at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:53)
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:91)
    at org.eclipse.jetty.server.Server.doStart(Server.java:263)
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:59)
    at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:1214)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:1137)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.eclipse.jetty.start.Main.invokeMain(Main.java:457)
    at org.eclipse.jetty.start.Main.start(Main.java:600)
    at org.eclipse.jetty.start.Main.main(Main.java:82)
  • 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-28T18:13:48+00:00Added an answer on May 28, 2026 at 6:13 pm

    First, your web.xml is wrong.

    The servlet-class element contains the fully qualified class name of the servlet.

    from web.xml schema you used http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd at line 923. Hence, the content of servlet-class element at line 9 should be MyServlet, not MyServlet.class.

    Second, use only one way to register a servlet, filter or listener to make it clear. If you prefer to use annotation to register them to a servlet container. You had better delete servlet and servlet-mapping element in web.xml. Otherwise, You had better delete annotations in java source. And if you want to use web.xml, you should update the schema version from 2.4 to 3.0

    Finally, your second problem came from the Jetty WTP Eclipse plugin can be solved by trying this: jetty run error for websockets project

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

Sidebar

Related Questions

I have downloaded Eclipse Java EE version (3.5) and I would like to use
I am using Fedora12. I have downloaded eclipse-cpp-galileo-SR1-linux-gtk. I am using Java version 1.6.0_18
I'm a Java developer and I've downloaded the Eclipse for C (course purposes) and
I'm new to Eclipse, and have the following question: I would like to use
I've downloaded the JAVA Eclipse IDE and started learning Java. I have a good
I downloaded the Eclipse IDE for Java Developers Linux 32 Bit file from here
I downloaded a plain eclipse which does not have java ee prospective. Now I
I just downloaded eclipse-java-helios-SR2-win32-x86_64.zip extracted the zip. When i'm trying to run i get
I installed (downloaded) Eclipse Helios (SR2-win32-x86_64). When I start eclipse.exe , I get the
I have downloaded eclipse 3.4 (java version) for MacOSX (carbon). I have tried to

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.