jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes Allocate exception for my firstr and very simple servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

Allocate exception for my firstr and very simple servlet

lucio bosque

Joined: Apr 28, 2010
Posts: 11
Hi ,
Can anyone please assist
I am a newbay to servlets , I am trying to create a simple servlet using eclipse helios with Jboss 5.1 GA .
I have created a new Dynamic Web project named JavaRanchSample , (AddingServletToSrc.JPG attach )
and then I have wrote the most simplest code can be in the DoPost method
PrintWriter out = response.getWriter();
out.println("Hello World");
Then I have tried to run it on the server (RunSrvOnJboss.JPG attach)
and I am getting the following exception :
20:22:03,250 ERROR [[FirstServlet]] Allocate exception for servlet FirstServlet
java.lang.ClassNotFoundException: lucio.FirstServlet
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:262)
at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(TomcatInjectionContainer.java:256)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1006)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:777)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)

[Thumbnail for SimplestServletCode.JPG]

[Thumbnail for AddingServletToSrc.JPG]

Martin Caminoa

Joined: Oct 25, 2010
Posts: 5
Seems to be related to web.xml configuration file.
lucio bosque

Joined: Apr 28, 2010
Posts: 11
thanks for you quick replay
I have tried alot of time to customize my web.xml file without success
the basic setting are as in the image attach.
and it's seems just fine

[Thumbnail for webxml.JPG]

David O'Meara

Joined: Mar 06, 2001
Posts: 13459

If you right-click the project and check the build path, the bottom of the first tab should have the default output folder and should be
(something something something)/WEB-INF/classes
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63211

Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please click this link ⇒ CarefullyChooseOneForum ⇐ for more information.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Allocate exception for my firstr and very simple servlet
It's not a secret anymore!