This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm having difficulty getting a taglib that I have developed to work as desired in WebSphere 6.1
I have an EAR that contains several WARs; the classloader is set to PARENT_FIRST / SINGLE (so each WAR can see resources defined in the others). One of the WARs contains the jar that defines the taglib, and the jar itself contains the .tld file in META-INF. According to the documentation (J2EE 1.4/JSP/Servlet) this is all that I need to do to make the taglib available to the JSPs in the same WAR. I do not have to modify web.xml or put an external .tld file in WEB-INF or META-INF of the WAR.
When I test the application from RAD 7.5 (this is based on Eclipse 3.4), then JSPs located in another WAR can use the taglibs defined in the jar without any problems. However, when I test using a full WebSphere install, I get the following error:
(the French there means "Unable to locate tag library")
I can only get the second WAR to see the taglib defined in the jar in the first WAR if I either copy the jar into the second WAR, or put the .tld definition from the taglib jar in the second WAR's WEB-INF. Deploying the jar at the EAR level has the same problem.
I want to use this taglib globally and so I don't want to have to either copy it into every WAR deployed or manually maintain a copy of the .tld file in every WAR (we have dozens of WARs).
To recap, the structure I want to be able to use is:
the structure that I find that I am forced to use either has mytaglib.jar in the WEB-INF/lib of WAR2 and WAR3 or has mytaglib.tld in WEB-INF of WAR2 and WAR3.
In essence my problem is that I seem to be unable to make the taglib in the jar defined in WAR1 available to the other WARs in the EAR. I would like to be able to do this and so am grateful to receive any suggestions. thanks - Mark
But I would be interested in knowing the solution if you are able to achieve what you wanted.
Joined: Feb 15, 2010
OK - that looks like a preferable solution to either copying the jar into each WAR or having an external tld file in each WEB-INF. I can put a reference to the tld in web.xml and let the classloader find it normally. Thanks very much for the suggestion - I'll let you know in the unlikely event that I find a superior solution