QUICK SUMMARY:
I need to load a site specific class from a tag in a global library using
Class.forName(). However, even after setting up <library-path> (points to
global tag library) in server.xml, and <classpath> (points to specific
site's library) in specific site web-application.xml, I still get
java.lang.ClassNotFoundException. The same code ("Class.forName") works
fine from a .JSP.
GENERAL SETUP:
I have the following directory structure:
all
all/config (contains global configuration with server.xml)
all/lib (contains tag library)
all/siteA
all/siteA/config (contains configuration for siteA with web-application.xml)
all/siteA/lib (contains siteA specific individual classes)
all/siteA/html (contains html/jsp code for siteA)
My tag library is located in all/lib, server.xml contains <library-path>
pointing to all/lib. My custom site individual .class files are located in
all/siteA/lib, web-application.xml in all/siteA/config contains a
<classpath> to all/siteA/lib. The following code works from a .jsp located
in all/siteA/html:
<% Class c = Class.forName("com.tl.menu.TreeNode"); %>
<% Class d = Class.forName("SubMenu"); %>
Class "com.tl.menu.TreeNode" is located under all/lib and thus is found
using <library-path>, I assume. Class "SubMenu" is located in all/siteA/lib
and thus is found using <classpath> setting.
PROBLEM DESCRIPTION:
When I put Class.forName("SubMenu") in to a tag, I get:
java.lang.ClassNotFoundException: SubMenu
It almost seems like tag libraries only see what is in the <library-path>.
I am building generic tags, which require custom interface implementation by
the application to provide the final functionality. The only thing that
appears to work is to put all/siteA/lib on the <library-path> in server.xml,
but this does not seem correct since server.xml deals with the ENTIRE
server, not specific web-site application.
QUESTION:
How can I make my tag library in all/lib see the custom classes that I have
written for the siteA located in all/siteA/lib?
Thanks.
-AP_