aspose file tools*
The moose likes Servlets and the fly likes Error loading WebappClassLoader,Why? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error loading WebappClassLoader,Why?" Watch "Error loading WebappClassLoader,Why?" New topic
Author

Error loading WebappClassLoader,Why?

Ghazala Islam
Ranch Hand

Joined: Nov 22, 2000
Posts: 73
Hi,

I am trying to access a servlet from a html page.

I am making project using Eclipse/MyEclipse

1)Project name is userregistration.
2)Servlet name is displayname which is in a package userpackage under src folder.
3)HTML file name is welcome which is accessing a servlet when submit button is clicked. The command for accessing servlet is :

FORM ACTION = �/servlet/userservlets.displayname� method = post

The problem is when I press save buttom in html form ,it gives message �Object not found� in browser.

The log for the localhost in Tomcat server says :

Dec 28, 2005 7:03:23 AM org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet org.apache.catalina.INVOKER.userservlets.displayname as unavailable
Dec 28, 2005 7:03:23 AM org.apache.catalina.core.ApplicationContext log
SEVERE: Error loading WebappClassLoader
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@349471
userservlets.displayname
java.lang.ClassNotFoundException: userservlets.displayname
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1332)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1181)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1027)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:750)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:369)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:536)
Dec 28, 2005 7:03:23 AM org.apache.catalina.core.ApplicationContext log
SEVERE: invoker: Cannot allocate servlet instance for path /servlet/userservlets.displayname
javax.servlet.ServletException: Wrapper cannot find servlet class userservlets.displayname or a class it depends on
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1035)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:750)
at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:369)
at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:169)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:536)
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@a0864f')
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@d1e233')
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@15983b7')
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@7976c1')
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@6397eb')
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@8aeb74')
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: SessionListener: contextDestroyed()
Dec 28, 2005 7:03:33 AM org.apache.catalina.core.ApplicationContext log
INFO: ContextListener: contextDestroyed()
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61222
    
  66

That's a red herring. The real error is:

javax.servlet.ServletException: Wrapper cannot find servlet class userservlets.displayname or a class it depends on

Why are you using the invoker? Read this.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ghazala Islam
Ranch Hand

Joined: Nov 22, 2000
Posts: 73
Fine, i configured my WEB-INF/web.xml as

<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>displayname</servlet-name>
<servlet-class>userservlets.displayname</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>displayname</servlet-name>
<url-pattern>/displayusername</url-pattern>
</servlet-mapping>

</web-app>

And give the url of servlet in html as:

form action = "/displayusername" method = "post"

Its again giving object not found.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Take the forward slash out of the action attribute


It's presence will cause the browser to skip your contextPath and look for:
http://www.yourdomain.com/displayusername


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ghazala Islam
Ranch Hand

Joined: Nov 22, 2000
Posts: 73
i take out the forward / from url and now it looks like :

form action = "displayusername" method = "post"

but now it says in browser :

Internal server error

and server error log look like this :

SEVERE: Allocate exception for servlet displayname
java.lang.UnsupportedClassVersionError: userservlets/displayname (Unsupported major.minor version 49.0)
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Some of your classes are out of date, you should make sure you recompile all of your java class files. I'm not sure how you have Eclipse set up, but it should manage this for you...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The good news it that your servlet was found.
You're getting closer.
Ghazala Islam
Ranch Hand

Joined: Nov 22, 2000
Posts: 73
Could it be a missing classpath setting in Eclipse Environment?becuse i have not updated any projects prperties assuming Eclipse will manage itself for detecting classpaths.For example compiling a text based class or servlet calss,we need to specify classpath setting in environment variables or at compile time,but i am not sure about Eclipse.
[ December 29, 2005: Message edited by: Ghazala Islam ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Error loading WebappClassLoader,Why?