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

error in servlet

Geeta Ravikanti
Ranch Hand

Joined: Mar 26, 2008
Posts: 46
this is my program


when i am running this program this is the exeption raising





HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Wrapper cannot find servlet class Retreive or a class it depends on
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:595)


root cause

java.lang.ClassNotFoundException: Retreive
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1340)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
java.lang.Thread.run(Thread.java:595)


}
}



previously i executed the same program properly and retrived the data from the table correctly
when i inserted the new rows in the table and run the above program its throwing that exeption
I added related jar file correctly,i set the classpath correctly
but why my program is not working
i am unable to find where i did the mistake
if any body find plese tell me where did i dont mistake

tahQ
geeta
[ April 02, 2008: Message edited by: David O'Meara ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

You should always package servlets
ramesh turlapati
Greenhorn

Joined: Apr 02, 2008
Posts: 4
jar files missing...
suri jagadish
Greenhorn

Joined: Sep 14, 2005
Posts: 19
Hi David,

I think you need to check back on what you have said about the servlets.

It is not absolutely necessary for a servlet to be in a package.

It can exist independently without a package and can be called.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61606
    
  67

Originally posted by suri jagadish:
It can exist independently without a package and can be called.
Sometimes it can work. Most times, it causes problems. In all cases, it's a poor practice. Why would you condone poor practices?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

and if the problem were package related, it would look just like that.

Is there any additional code we're missing? Like constructors, instance or static blocks? The problem could also be caused by the class failing to load.

I'd also make sure you don't accidentally have the servlet.jar or servlet classes packaged with your web app (eg in the WEB-INF/lib directory)
suri jagadish
Greenhorn

Joined: Sep 14, 2005
Posts: 19
Hi Bear,

Well you are right its not a good practice. I Myself don't code that way.
But i was only trying to establish a fact.
[ April 03, 2008: Message edited by: suri jagadish ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by suri jagadish:
... But i was only trying to establish a fact.


There are some cases where unpackaged classes will not be found in a servlet application and some cases where they will. If anyone's interested in the specific reasons for this, see:
http://faq.javaranch.com/search?PackageYourBeans
It contains links to the relavent bug reports on Sun's site.

Rather than get into the nuances of when you can get away with using the default package and when you can't--a confusing thing to have to learn just to get away with ignoring a good practice--we (knowing full well what the facts are) stress that all classes in a Java web application should be packaged, period.

From, an academic standpoint, it might be interesting to learn all the ins and outs of this, and for an intermediate, who has to maintain a large legacy application it might actually be useful to understand when an unpackaged class will or will not be found when debugging a ClassNotFoundException. For someone starting out learning servlets, however, there is never a good case for using the default package in a web application and the smartest thing to do (especially when trying to figure out why one of these early examples isn't working) is to rule out any of these subtle bugs by packaging everything, always. To teach someone otherwise is to do them a disservice.
[ April 03, 2008: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: error in servlet