>>> On 4/20/2007 at 9:16 AM, in message
<[EMAIL PROTECTED]>, "Craig
McClanahan" <[EMAIL PROTECTED]> wrote:
> On 4/20/07, Ken Miller <[EMAIL PROTECTED]> wrote:
>>

...

>> When I first started getting struts working in my environment, I deployed 
> the application with the struts jar files in the lib directory, and I was 
> able to use the taglibs without making any changes to web.xml to create a 
> uri-to-location mapping.  (I take it the struts code looks for these tlds 
> automatically upon startup, yes?)
>>
> 
> Actually, it is the JSP page compiler (part of the servlet container)
> that looks for these things, but yes, a modern container will scan JAR
> files for "*.tld" files in the META-INF directory.

Ah.  So perhaps the container isn't  looking in META-INF directory; only in 
WEB-INF.  I'll have to do a bit more digging on that one.

>> However, when I moved the struts jars into their own 'app', I was no longer 
> able to do this.  Placing a mapping in web.xml didn't help, and the only 
> thing I could do was place the tlds in the WEB-INF directory in the web app.  
> The strange this was that I was able to load the tlds via the class loader, 
> although I didn't try it through the context class loader.
>>
> 
> What does "moved the struts jars into their own 'app'" mean?  If you
> moved them to a different web application, they won't be accessible at
> all.  If you put them someplace like Tomcat's
> $CATALINA_HOME/shared/lib directory, the JAR files should be
> accessible ... but I have no idea whether Tomcat scans those JARs as
> well as the ones in WEB-INF/lib.

Yeah, I didn't explain that very well, did I?  In the environment I'm working 
in, you can create classloader references from one application to another. 
Class loading is therefore enhanced in the following way: if a class cannot be 
loaded by the parent class loader chain, nor by the source class, references 
are then checked for the class.  Note that a reference is only followed one 
level, so if the class (or resource) can't be found in the referenced 
application, an exception is thrown.

In the case I described above, I placed the struts libraries into their own 
application (technically called a library), and deployed that to the server.  I 
then set a reference from my application (which contains the action code) to 
the struts library container.  The application will run correctly as long as 
the tld's are placed in the WEB-INF/tld directory of the source application; 
for some reason, the servlet container cannot location the tlds when they 
reside in the struts library.  However, I just ran a quick test, and neither 
the class loader nor the context class loader (which happen to be the same 
object, btw) can load the objects from the jar files.

So, I guess I have to store the tld's in the source application.   What's 
strange is that even though I create a mapping from URI -> META-INF/tld/XX.tld, 
the container still can't load the files....

Thanks again for your help Craig.

-- 

Cheers!

      -klm.

-----------------------------------------------------------------------------
Kenneth (Ken) L. Miller
Technical Specialist, Enterprise Web Portals
    Cell: 403.680.3785
Office: 403.750.1790



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to