• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Class not found exception : Http status 500

 
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

This error is regarding jsp files..There is error saying

javax.servlet.ServletException: Wrapper cannot find servlet class result or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)


root cause

java.lang.ClassNotFoundException: result
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1355)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)


not able to recognize the class file result..


following my web.xml code

<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 web-app_2.4.xsd"
version="2.4">

<servlet>
<servlet-name>Hobby Page</servlet-name>
<servlet-class>result</servlet-class> --This is my class file
</servlet>

<servlet-mapping>
<servlet-name>Hobby Page</servlet-name>
<url-pattern>/result.jsp</url-pattern>
</servlet-mapping>
</web-app>
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java class names should not be lower case. You should call it Result instead of result.
But this is not the reason the Classloader cannot find the class. Does it belong to any package?
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Naming convention is ok..

my directory structure is :
C:\Program Files\apache-tomcat-5.5.20\webapps\jsp-su\WEB-INF\classes\Result.jsp

C:\Program Files\apache-tomcat-5.5.20\webapps\jsp-su\WEB-INF\web.xml
 
S Kapoor
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A couple of things here:

If Result is a jsp file, the web.xml should read as follows:
<servlet>
<servlet-name>Hobby Page</servlet-name>
<file-name>/Result.jsp</file-name>
</servlet>

Also, jsp files should not be placed under the classes directory. They should be either webapp directory (or a subdirectory there) or under WEB-INF (if you dont want clients to directly access the jsp).
Accordingly modify the <jsp-file> element to point to the jsp.
[ February 05, 2007: Message edited by: S Kapoor ]
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again Kapoor..

ie if i place my jsp files under webapps directory working fine..that to if i access directly like http://localhost/jsp-su/Result.jsp..

But if i do it with .htm file getting cass not found exception..

wr do i see class files??

my modified web.xml code is

<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 web-app_2.4.xsd"
version="2.4">

<servlet>
<servlet-name>Hobby Page</servlet-name>
<file-name>/Result.jsp</file-name>
<servlet-class>Result</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Hobby Page</servlet-name>
<url-pattern>/result.jsp</url-pattern>
</servlet-mapping>
</web-app>
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Manju, there are multiple things that aren't correct. Your attempt to place files in the classes folder suggests that you've not done this before, which is fine, but I think it would help you to educate yourself further before attempting to make your own app quite yet.

To get a decent understanding of how everything is supposed to fit together, I highly recommend browsing the sample jsp and servlet apps that come packaged with Tomcat. See if you can understand how and why the sample apps work. If you have any doubts about them please feel free to ask about them.
 
Manju Devarla
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Marc for your advice..

Again Kapoor thanks man..i done it..i am able to acces my jsp files thru html forms also..
done the change in web.xml

<jsp-file>/Result.jsp</jsp-file>..now its working fine
 
reply
    Bookmark Topic Watch Topic
  • New Topic