File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes Using Tomcat's commons-digester.jar in Servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Using Tomcat Watch "Using Tomcat New topic
Author

Using Tomcat's commons-digester.jar in Servlet

Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Hello All,
I have a servlet which uses the Digester class. Now, when running in the Tomcat container, I get a ClassNotFoundException because my app cannot find the jar file. Naturally, it will work if I put the jar file in WEB-INF/lib, but isn't this redundant, since this jar file is already present in CATALINA_HOME/server/lib? How can I reference this jar from my webapp? Thanks!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

server/lib does not become part of the web app classpath. You can put it in common/lib, shared/lib, or your app's WEB-INF/lib.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Thanks. I've removed the jar file from server/lib and placed it in common/lib and everything seems to be working fine. Tomcat has not barfed (since it can still find the jar file with its classloader). I don't know why commons-digester.jar was placed in the server-only server/lib directory. Oh well.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Perhaps Tomcat itself needs it.
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
That's correct. Tomcat uses digester to make sense out of server.xml
file present in the conf folder.
Jeffrey Hunter
Ranch Hand

Joined: Apr 16, 2004
Posts: 305
Yes, but for some reason this jar was placed in the server/lib, where it is visible only to Tomcat. I have several apps which use this jar file, so instead of copying the jar into the respective WEB-INF/lib, I moved it to common/lib, so I don't have to have the jar file all over the place. Tomcat didn't complain, so I think the commons-digester.jar can live in common/lib without a problem.
 
 
subject: Using Tomcat's commons-digester.jar in Servlet
 
Similar Threads
ClassCastException: org.apache.struts.action.ActionServlet cannot be cast to javax.servlet.Servlet
maven log4j problem
Building a jar with dependancies.
JSP-Examples not working
gwt upgrade to 2.4 problem