2012/3/16 Johannes Ernst <jer...@netmesh.us>:
>
> On Mar 15, 2012, at 16:50, Konstantin Kolinko wrote:
>
>> 2012/3/16 Johannes Ernst <jer...@netmesh.us>:
>>> I've implemented my own org.apache.catalina.loader.WebappLoader. It 
>>> consults a bunch of JARs held in the file system outside of the WAR.
>>>
>>> One of those outside JARs contains a custom JSP tag.
>>>
>>> When attempting to compile the JSP, Jasper fails to find it. I'm getting 
>>> this:
>>> javax.servlet.ServletException: org.apache.jasper.JasperException: Unable 
>>> to compile class for JSP:
>>>
>>> An error occurred at line: 13 in the jsp file: /foobar.jsp
>>> com.example.MyCustomTag cannot be resolved to a type
>>
>>
>>> My guess is that I somehow need to tell Jasper that it should use my custom 
>>> WebappLoader when looking for custom tags.
>>
>> You cannot.  Jasper is independent from Catalina.
>
> Darn …
>
>> Moreover Jasper has to pass a classpath to an external Java compiler
>> (ecj or javac). The classpath is constructed and passed to Jasper as
>> String.
>
> Could you point me to where in the code it does this? I was looking for 
> invocations of something like
>        WebappLoader.getRepositories()
> but came up empty.


WebappLoader is not a class loader per se. It is just a Tomcat
component that configures a class loader.  The class loader is
WebappClassLoader class.

The method is WebappClassLoader#getURLs() that returns URL[]

In Tomcat 6.0.x the following places of interest call it:

- in WebappLoader:
WebappLoader#setClassPath()

- in Jasper:
 JspRuntimeContext#initClassPath()\
 JspRuntimeContext#initSecurity()
 TldLocationsCache#scanJars()


>>> How would I do that? A few hours worth of poking around in the source code 
>>> hasn't helped …
>>>
>>> This is Tomcat 6.0.28 but any answer for any version is appreciated.
>>>
>>
>> Have you looked at VirtualWebappLoader class? I would think it already
>> does what you are trying to do.
>
> Does it work with custom JSP tags? If so, I fail to see where it accomplishes 
> that ...

Yes.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to