On 05/09/2016 20:14, Mark Thomas wrote:
> On 03/09/2016 14:07, vimil wrote:
>> I looked at tomcat 8  source code to determine how the class loader resolves
>> libraries and class folders specified in post resources.
>>
>> if the order of post resources is as follows
>>
>> <PostResources base="D:\Projects\external\classes"
>> className="org.apache.catalina.webresources.DirResourceSet"
>> webAppMount="/WEB-INF/classes"/>
>>
>> <PostResources base="D:\Projects\lib\library1.jar"
>> className="org.apache.catalina.webresources.FileResourceSet"
>> webAppMount="/WEB-INF/lib/library1.jar"/>
>>
>> then the class loader looks for classes in library1.jar before it looks for
>> classes in D:\Projects\external\classes
>>
>> which seems counterintuitive.
> 
> Yes, it is.
> 
> Under the covers, the contents of JARs are mapped to /WEB-INF/classes
> much like you have done in your work-around. The difference is that the
> set of resources they are added to is higher in the search priority than
> the PostResources.
> 
> I'm not sure if there is an easy way to fix this. I need to look at the
> code some more. If there isn't an easy fix, your work-around is the way
> to go.

It is fixable but as I thought about it some more I reached the
conclusion that fixing this was the wrong thing to do. By leaving the
behaviour as it is - and documenting it more clearly - users retain the
option to select the behaviour that best suits there needs.

I have, therefore, updated the docs for 9.0.0.M11, 8.5.6 and 8.0.38 to
explain the differences in behaviour.

Mark


> 
> Mark
> 
> 
>>
>> I worked around this issue by specifying PostResources as follows.
>>
>> <PostResources base="D:\Projects\external\classes"
>> className="org.apache.catalina.webresources.DirResourceSet"
>> webAppMount="/WEB-INF/classes"/>
>>
>> <PostResources base="D:\Projects\lib\library1.jar"
>> className="org.apache.catalina.webresources.JarResourceSet"
>> webAppMount="/WEB-INF/classes"/>
>>
>> Do you think my issue is valid, or I just have to configure resources the
>> way I showed above to get correct ordering when resolving classes?
>>
>>
>>
>>
>> --
>> View this message in context: 
>> http://tomcat.10.x6.nabble.com/Tomcat-8-5-Regarding-PostResources-for-Web-Inf-lib-and-Web-Inf-classes-tp5053929p5054690.html
>> Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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

Reply via email to