aspose file tools*
The moose likes Servlets and the fly likes trouble importing classes into servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "trouble importing classes into servlet" Watch "trouble importing classes into servlet" New topic
Author

trouble importing classes into servlet

Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

I have a servlet that compiles

import statements:


which are found in .jar file that I created out of some code I found here:
http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower-p2.html
The purpose is to view a String of a prepared statement as it looks as it is interpreted by the database.

When the servlet runs, I get the noClassDefFound error that it can't find
com/javaunderground/jdbc/SqlFormatter

which is an abstract class extended by OracleSqlFormatter:

and is present in the .jar file
I am wondering why my servlet can't find this class but it can find other classes in the same jar file??
I am wondering if I made my jar file wrong somehow?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
The first question is - where did you put the Jar file? Tomcat does not use your environment CLASSPATH.
Your Tomcat installation has a nice discussion of how Tomcat finds files in the webapps/tomcat-docs/class-loader-howto.html file.
Bill
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

Thanks for your reply. I was sure I had placed it in the lib directory of my web application, but when I looked at the behest of someone here, lo, it wasn't there.
Now to fix my build.xml to move the .jars when I deploy so I don't make this mistake again..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: trouble importing classes into servlet