when I try to run my project on Jetty I get this exception:
java.lang.ClassNotFoundException: Default
The full stack:
Launching Jetty with port 8080, context / and webapp path src/main/webapp
2011-07-19 16:49:56.832:INFO::Logging to STDERR via org.mortbay.log.StdErrLog
2011-07-19 16:49:56.841:INFO::jetty-6.1.26
2011-07-19 16:49:57.181:WARN::EXCEPTION
java.lang.ClassNotFoundException: Default
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.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:401)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
at org.mortbay.util.Loader.loadClass(Loader.java:91)
at org.mortbay.util.Loader.loadClass(Loader.java:71)
at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:242)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:736)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at net.sourceforge.eclipsejetty.launch.JettyLauncherMain.launch(JettyLauncherMain.java:67)
at net.sourceforge.eclipsejetty.launch.JettyLauncherMain.main(JettyLauncherMain.java:50)
2011-07-19 16:49:57.184:INFO:/:Unavailable javax.servlet.UnavailableException: Default
2011-07-19 16:49:57.185:WARN::failed Default: java.lang.NullPointerException
2011-07-19 16:49:57.283:WARN::Failed startup of context org.mortbay.jetty.webapp.WebAppContext@5f1eb199{/,src/main/webapp}
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:736)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:224)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
at net.sourceforge.eclipsejetty.launch.JettyLauncherMain.launch(JettyLauncherMain.java:67)
at net.sourceforge.eclipsejetty.launch.JettyLauncherMain.main(JettyLauncherMain.java:50)
2011-07-19 16:49:57.294:INFO::Started SocketConnector@0.0.0.0:8080
I says that it cannot load my class Default.java (the only class in my project).
Here is my structure (UPDATED):
And I deploy my project using the Jetty plugin. To run it, I right click my project and select Debug As-> Debug Configurations... and I select the one that is setup below:
Here is also my web.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web- app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>ServletWeb-Test</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<description></description>
<display-name>Default</display-name>
<servlet-name>Default</servlet-name>
<servlet-class>Default</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Default</servlet-name>
<url-pattern>/Default</url-pattern>
</servlet-mapping>
I am running out of idea and I can't find why I get this error. I someone could help me, I would gladly appreciate it!