Where do I put jar files in Tomcat 6?

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2011-01-06T19:44:26Z Indexed on 2011/01/06 19:53 UTC
Read the original article Hit count: 314

Filed under:
|
|

I am having trouble getting my JSP page to load a Java class which is in a jar file. The message I get appears to indicate a class not found exception:

Jan 6, 2011 12:21:45 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: 72 in the jsp file: /xmlloader.jsp
FactArray cannot be resolved to a type
69:         sourceType = "1";
70: }
71: 
72: FactArray fa = new FactArray();
73: Fact f;
74: 
75: /***********************/

The Type FactArray is one of my classes in a package com.mypackage.fact.FactArray which exists in myjar.jar. myjar.jar is a separate Java project (using NetBeans, but I don't think that's relevant).

I include the package in my JSP as follows:

<%@ page import="com.mypackage.fact.*" %>

I deploy my web site and JSPs into Tomcat 6 as a WAR file. I include myjar.jar in that WAR in WEB-INF/lib but that doesn't work. I tried putting myjar.jar in my tomcat/lib folder, but that doesn't work either.

I have bounced the server several times between changes. I have read a whole bunch of questions on here which say "put it in WEB-INF/lib" but that isn't working, so I'm asking my own question.

Where do I need to put common JAR files so they get picked up by Tomcat?

© Stack Overflow or respective owner

Related posts about jsp

Related posts about jar