On Wed, Dec 17, 2014 at 2:00 AM, Christopher Schultz <
ch...@christopherschultz.net> wrote:
>
>
> Nan,
>
> On 12/16/14 5:37 AM, Nan Ge wrote:
> > I'm using Tomcat8. I'm not quite understand about the description
> > of 'scanAllDirectories' attribute of the <JarScanner> component.
> > The doc says if this attribute is set true, 'any directories found
> > on the classpath will be checked to see if they are expanded JAR
> > files. ... Tomcat determines if a directory is an expanded JAR file
> > by looking for a META-INF sub-directory'.
> >
> > Does it mean that we could extract the content of a JAR
> > file(including the META-INF dir) to a folder under /WEB-INF/lib or
> > /WEB-INF/classes(with unpackWAR=true) of my web application, and
> > Tomcat will load associated classes, which were originally in the
> > JAR, from this folder?
>
> I haven't tried, but I would guess that it would only work under
> WEB-INF/lib and not WEB-INF/classes since WEB-INF/classes isn't
> expected to ever contain JAR files (at least not ones that are
> automatically added to the classpath, like .jar files in WEB-INF/lib are).
>
> > I have tried this, but it seems not to work.
>
> What does your configuration look like? What about your directory
> structure?
>
> > So what does 'expanded JAR' mean? And how could we make use of it?
>
> foo.jar - a JAR file
> foo     - a directory containing everything that foo.jar contains
>
> That second one is an expanded JAR file.
>
> - -chris
>
>
Thanks Chris!

My configuration looks like this:

<?xml version='1.0' encoding='GBK' ?>
<Context  docBase="F:/projects/myapp/target/myapp" path="/myapp"
privileged="true" reloadable="false" workDir="work/myapp">
<JarScanner scanAllDirectories="true" />
</Context>

And the directory structure looks like this:
F:\PROJECTS\MYAPP
├─src
│  └─main
│      ├─java
│      └─webapp
│          └─WEB-INF
│              └─lib
└─target
    └─myapp                   //this is my web application context root
        ├─META-INF
        └─WEB-INF
            ├─classes
            └─lib
                └─mybiz         //this folder contains classes extracted
from mybiz.jar
                    ├─META-INF
                    └─myapp
                        └─biz

Reply via email to