users@glassfish.java.net

Filter Servlet Classpath question

From: <glassfish_at_javadesktop.org>
Date: Mon, 10 Mar 2008 12:21:57 PST

I have written a Filter servlet that is packaged in a "common" library jar file. The goal is to use this same Filter with many EAR / WAR files.

In my web.xml I specify the filter:

<filter>
<filter-name>AuthorizationFilter</filter-name>
<filter-class>edu.utah.acs.lib.login.security.AuthorizationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthorizationFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>

Unfortunately when I deploy/run the EAR file I get this:

Cannot load edu.utah.acs.lib.login.security.AuthorizationFilter reason : edu.utah.acs.lib.login.security.AuthorizationFilter
and
WebModule[/vendorSearch-war]Exception starting filter AuthorizationFilter
java.lang.ClassNotFoundException: edu.utah.acs.lib.login.security.AuthorizationFilter

Why is this happening? The "common" jar file is packaged in the WAR file.

If I place a copy of the "common" jar file in domains/domain1/lib I can avoid this this problem. But this does not seem like an ideal solution, as a matter of fact it feels wrong for a variety of reasons.

Also if I move the Filter code into the WAR file directory structure I don't get the the class not found error.

I'm developing in NetBeans 5.5 and using a Sun Appserver 9.

Thanks for any help.
[Message sent by forum member 'bryanut' (bryanut)]

http://forums.java.net/jive/thread.jspa?messageID=263237