Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error loading WebappClassLoader,Why?

 
Ghazala Islam
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64632
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ghazala Islam
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ghazala Islam
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The good news it that your servlet was found.
You're getting closer.
 
Ghazala Islam
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic