On 01/08/17 12:29, DESFORGES, Frederic wrote:

<snip/>

> This is not working : the server started and but I can't access to test.html 
> (library.jar/META-INF/resources/test.html)
> <Resources>
>    <JarResources  base="<absolutePath>\0.0.1-SNAPSHOT\library.jar" 
> className="org.apache.catalina.webresources.JarResourceSet" 
> webAppMount="/WEB-INF/lib" />
>   <PostResources base="<absolutePath>\target\classes" 
> className="org.apache.catalina.webresources.DirResourceSet" 
> webAppMount="/WEB-INF/classes" />
> </Resources>

That is exposing the contents of library.jar to WEB-INF/lib. There are
several problems with that:
- it ignores the META-INF/resources
- the contents of the JAR should be mapped to WEB-INF/classes
- it is adding it as a JAR resource which is an odd priority


> Other case that are not working :
> <Resources>
>    <JarResources  base="<absolutePath>\ 0.0.1-SNAPSHOT\library.jar" 
> className="org.apache.catalina.webresources.JarResourceSet" 
> webAppMount="/WEB-INF/classes" />
>   <PostResources base="<absolutePath>\target\classes" 
> className="org.apache.catalina.webresources.DirResourceSet" 
> webAppMount="/WEB-INF/classes" />
> </Resources>


This fixes the mapping location but the other issues remain.


> <Resources>
>    <PostResources base="<absolutePath>\0.0.1-SNAPSHOT\library.jar" 
> className="org.apache.catalina.webresources.JarResourceSet" 
> webAppMount="/WEB-INF/classes" />
>   <PostResources base="<absolutePath>\target\classes" 
> className="org.apache.catalina.webresources.DirResourceSet" 
> webAppMount="/WEB-INF/classes" />
> </Resources>
> (the last example is ok to not work according to the documentation (only 
> jarResources are eligible for META-INF/resources scanning) )


That isn't quite right. JarResources are the result of
META-INF/resources scanning.


> So my question is that normal behavior of    <JarResources  or do I need more 
> configuration to make it work using  
> className="org.apache.catalina.webresources.JarResourceSet" ?

Everything you describe as as expected.

What I think you want is:
<Resources>
  <PostResources base="<absolutePath>\0.0.1-SNAPSHOT\library1.jar"
      className="org.apache.catalina.webresources.FileResourceSet"
      webAppMount="/WEB-INF/lib/library1.jar"/>
  <PostResources base="<absolutePath>\target\classes"
      className="org.apache.catalina.webresources.DirResourceSet"
      webAppMount="/WEB-INF/classes" />
</Resources>

What the above configuration does is treats library1.jar as if it was
located in WEB-INF/lib and target\classes as if the contents of that
directory were location in WEB-INF/classes.

Does that work any better?

HTH,

Mark

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

Reply via email to