Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-18 Thread Mark Thomas
On 18/12/2014 01:57, Nan Ge wrote:


 Which part of WEB-INF/lib is only ever scanned for JARs. Everything
 else is ignored. did you not understand?
 
 
  Yes, I see that only WEB-INF/lib/*.jar files are scanned.
 
 
 And which directories/classpath  the document indicates when it saying
 If
 true, any directories found on the classpath will be checked to see if
 they
 are expanded JAR files , if it won't work for either of those
 directories?

 As per the docs, scanAllDirectories applies to directories found on the
 class path not to WEB-INF/lib since it is not on the class path.
 (WEB-INF/lib/*.jar is on the class path and that is not a directory).

 And for WEB-INF/classes, only unpacked classes and resources(without any
 top-level non-package-name directories) are accepted, an expanded JAR
 file is not accepted here.

Wrong. If WEB-INF/classes/META-INF exists and scanAllDirectories is set,
the contents of WEB-INF/classes will be treated as an expanded JAR.

 The difference between unpacked classes and
  expanded JAR file is whether there is a top-level folder outside plus a
 sibling META-INF folder beside the unpacked classes, is it right?

Wrong again. See above.

 Then where else should I put an expanded JAR file, except WEB-INF/lib
 and WEB-INF/classes?

should depends on what you are trying to achieve - something you
haven't yet explained.

 How to define the class path?

Generally you don't. Explicitly changing the class path is usually a
sign you are doing something wrong.

Mark


 I will be very appreciative if any of you could give me an example to
 illustrate the usage of scanAllDirectories and  expanded JAR file.
 
 Regards,
 Nan
 


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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 12/18/14 3:44 AM, Mark Thomas wrote:
 On 18/12/2014 01:57, Nan Ge wrote:
 
 
 Which part of WEB-INF/lib is only ever scanned for JARs.
 Everything else is ignored. did you not understand?
 
 
 Yes, I see that only WEB-INF/lib/*.jar files are scanned.
 
 
 And which directories/classpath  the document indicates when
 it saying
 If
 true, any directories found on the classpath will be checked
 to see if
 they
 are expanded JAR files , if it won't work for either of
 those directories?
 
 As per the docs, scanAllDirectories applies to directories
 found on the class path not to WEB-INF/lib since it is not on
 the class path. (WEB-INF/lib/*.jar is on the class path and
 that is not a directory).
 
 And for WEB-INF/classes, only unpacked classes and
 resources(without any top-level non-package-name directories) are
 accepted, an expanded JAR file is not accepted here.
 
 Wrong. If WEB-INF/classes/META-INF exists and scanAllDirectories is
 set, the contents of WEB-INF/classes will be treated as an expanded
 JAR.

This sounds odd to me; isn't WEB-INF/classes *always* treated as if it
were an expanded JAR file? That is, WEB-INF/classes is directly in
the webapp's classpath and resources in there can be loaded by the
classloader. If foo.jar (regardless of its location) were on the
classpath, anything inside of it can be loaded by the classloader.

It doesn't make any sense to me to differentiate between
WEB-INF/classes as ... whatever it is usually considered, and using
scanAllDirectories=true to treat is as an expanded JAR file
because the behavior -- as best as I can tell -- is entirely identical.

I've read the documentation for JarScanner several times now because
of this thread, and it's entirely unclear to me what e=the difference
in behavior will be given that documentation plus your comments here.

Mark, can you clarify what behavior will actually change when
scanAllDirectories=true is set?

 Then where else should I put an expanded JAR file, except 
 WEB-INF/lib and WEB-INF/classes?
 
 should depends on what you are trying to achieve - something you 
 haven't yet explained.

I get what you're trying to do, here, and its not entirely clear to me
under what circumstances an expanded JAR file would be useful. It
would be nice to understand a proper use-case for this feature,
because one presumably exists or the feature would not.

Thanks,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUkuJGAAoJEBzwKT+lPKRY62kQAIb5pFsSeGVvRZDt9bDcyMm8
bHhYAY+e/vp97BWms7McBy9XZlYC5sH5UrSvGNBi1YrxNxVoQwQ4CqDEdXKpiQW1
PuxBQYJ5Bz3xaWzxQF9EEPIuFgspVnOu6bEHUGvP07LocFFWjXHCV+JN/onCERPI
G0T3Q1R2d/7fYsv3G4YM4+ofxqmaX0awDH6bmjznuTv68t/oY5JyR49Zev1r39jo
R/8kYjlNj8hoSbP/E9G7nqVwz4xdaL+yXsw/ATEr2tDC/7Q55ouXCbsX67H4wggt
Mb748b+gYxfaDrL3BCa2F7WGuold3APmOeT1jpWaumZEhCcogjSj5p/t8s+KaXID
rz6QDoj3ofF4cCiHLKTgA6KIE/HHYOsq31Kk0Q6rnuqmEvTKkOAOjpVU50Uz/tqo
FAJLuGnPfz/nZlH6K2Cg/qiftBXGSjiZtLR46w+I/nuishk3Lo0EtBMmnNJ6ErzQ
tmIXSAZxqAFMjVyLrbt/7XtpG+ZMtQeGP+NT3XllchX78f2PU9xe9svL1Acxaoiu
96BIFS0CpTPZ1tq86L2qvPUyOGVwf6LnNCjbXOg8fJDT38KOaa/pSXRF1UFteV5K
CX9xUgD08hHvTuXy4kQyWAwjnqIZHgWYPx1bk4fTxHqShLPwU5rsEjsQkg+sUGfN
rCDxyDa0UTvJVa8/XBrD
=wXLV
-END PGP SIGNATURE-

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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-18 Thread Mark Thomas
On 18/12/2014 14:18, Christopher Schultz wrote:

 Mark, can you clarify what behavior will actually change when
 scanAllDirectories=true is set?

A JAR file is scanned for SCIs, static resources etc. A directory of
classes is not. Setting scanAllDirectories causes directories of classes
(including WEB-INF/classes) to be treated as expanded JAR files. It is
normally only used when integrating with an IDE.

Mark

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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Mark,

On 12/18/14 9:38 AM, Mark Thomas wrote:
 On 18/12/2014 14:18, Christopher Schultz wrote:
 
 Mark, can you clarify what behavior will actually change when 
 scanAllDirectories=true is set?
 
 A JAR file is scanned for SCIs, static resources etc. A directory
 of classes is not. Setting scanAllDirectories causes directories of
 classes (including WEB-INF/classes) to be treated as expanded JAR
 files. It is normally only used when integrating with an IDE.

Interesting.

I was about to say:

Does that mean that, under a default configuration, having an SCI in
your WEB-INF/classes will not be found and called? That would be
surprising to me if I were trying to use SCIs directly in my
application (as opposed to using them indirectly, through a library,
as usually happens).

...until I read the documentation for SCI which says this at the end:


Implementations of this interface must be declared by a JAR file
resource located inside the META-INF/services directory and named for
the fully qualified class name of this interface, and will be
discovered using the runtime's service provider lookup mechanism or a
container specific mechanism that is semantically equivalent to it. In
either case, ServletContainerInitializer services from web fragment
JAR files excluded from an absolute ordering must be ignored, and the
order in which these services are discovered must follow the
application's classloading delegation model.


I've never (directly) used SCIs or META-INF/services or static
resources of anything like that so I didn't know about them having to
be packaged in a certain way.

So, under normal circumstances, only CATALINA_HOME/lib,
CATALINA_BASE/lib, and WEB-INF/classes would fail to have SCIs and
static resources scanned/loaded from them directly, and enabling this
feature would allow you to put e.g. META-INF/services into
CATALINA_BASE/lib and then configure services there.

So the only real use case for this is when you are customizing the
webapp's classpath in some way (which IDEs do) or if you want to write
your own SCI or use static resources without packaging them into JARs
and putting them in WEB-INF/lib. I can see that being a valid use
case, but probably one that is very rare.

Thanks for the clarification,
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUkxY9AAoJEBzwKT+lPKRYnlgP/jXCtr3HhRYy5W0vLwX04NIt
Ht8tai57j11UFsQqDnb9mppJ75L8JPVMgm7jAKZOQtfo5gIZhLl9VXlbCMFuZxTh
RizJoAejYGmWY2qxXtQ7x8q+8gHMPldjpjtgSc4ORRJ0ME3O1PZIDggBxFp+S7Cy
N7RNDoWZ9PX02kkJzojTzb9dy/NvXScYi/KnJ9w2dOtJFFzlqlgn0f9sUJP00mSm
I/j37bhIYowiFzhh3CYNEAVwTUaXJhiRyGue7ABmjguCu28Ys1HwvSKQcE3e0Skd
eOgmQbafqWZO1bkhlSiAvGDs+HEd1zctnxwOsg1+uLW1c/FyKXMD3ptI+kPg0fh4
SRU29U/22v85SH+fqUQ27Oltkk/WR2645FJwz1usaO2JZsz3S18KBpq9+2XxEPWq
TS7k0dPruC2SJF+eaWwCuq1q0NfJVk1Ri2ighTmeABBKJCJgy9hJZUup/u8VRZJR
vQpM9Sz7pWwBvBNliC88q7iJqqPvWZPWvmz+u7XA8AAs7DuKkaRLIdQo12imsHy8
9QlpFyEfNeomEAKvOEeJelkUcaBkiXyBHT08zRrejhClRjSbqGVeiTQu4aWBBtob
xbersVEiY7FstpvLGgLMOW2zJhCrCyfYTYsJ0XZ/BVuQkHtZ+ZG+u2h5nIFGLTcw
h9o4aSxyB9NA8pJ8CL2I
=HzPs
-END PGP SIGNATURE-

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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-18 Thread Nan Ge
Thank you Mark and Chris! So that's about something like SCI etc., your
replies are very helpful.
Thanks again!

Regards,
Nan


Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-17 Thread Mark Thomas
On 17/12/2014 02:08, Nan Ge wrote:
 On Wed, Dec 17, 2014 at 2:43 AM, Mark Thomas ma...@apache.org wrote:

 On 16/12/2014 18:00, Christopher Schultz 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 see the logic behind the guess but it is wrong. This option won't work
 for either of those directories.
 ?
 Mark

 Thanks Mark!
 
 Then how to make this 'scanAllDirectories' attribute work,

The attribute does work. There is nothing wrong with it.

 or do you mean it has been discarded in Tomcat8.0 ?

I mean nothing of the sort.

Mark


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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-17 Thread Mark Thomas
On 17/12/2014 01:56, Nan Ge wrote:

 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

WEB-INF/lib is only ever scanned for JARs. Everything else is ignored.

classes belong in WEB-INF/classes without the top-level mybiz directory.

Mark


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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-17 Thread Nan Ge
On Wed, Dec 17, 2014 at 4:07 PM, Mark Thomas ma...@apache.org wrote:

 On 17/12/2014 01:56, Nan Ge wrote:

  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

 WEB-INF/lib is only ever scanned for JARs. Everything else is ignored.

 classes belong in WEB-INF/classes without the top-level mybiz directory.

 Mark


Yes, classes belong in WEB-INF/classes without any top-level
non-package-name directory is the standard deployment structure defined by
the servlet spec.

What I really want to know is what the consequence will be if we set
scanAllDirectories=true
and the Jar Scanner assumes the folder to be an expanded JAR file(if the
META-INF sub-directory exists) ? Could the classes within the expanded
JAR folder
be loaded by the web application class loader?


I see the logic behind the guess but it is wrong. This option won't work for
either of those directories.


And which directories/classpath  the document indicates when it saying If
true, any directories found on the classpath will be checked to see if they
are expanded JAR files , if it won't work for either of those
directories?

Regards,
Nan


Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-17 Thread Mark Thomas
On 17/12/2014 10:38, Nan Ge wrote:
 On Wed, Dec 17, 2014 at 4:07 PM, Mark Thomas ma...@apache.org wrote:

 On 17/12/2014 01:56, Nan Ge wrote:

 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

 WEB-INF/lib is only ever scanned for JARs. Everything else is ignored.

 classes belong in WEB-INF/classes without the top-level mybiz directory.

 Mark
 
 
 Yes, classes belong in WEB-INF/classes without any top-level
 non-package-name directory is the standard deployment structure defined by
 the servlet spec.
 
 What I really want to know is what the consequence will be if we set
 scanAllDirectories=true

The consequences will be as specified in the documentation.

 and the Jar Scanner assumes the folder to be an expanded JAR file(if the
 META-INF sub-directory exists) ?

It won't since the folder in this case is WEB-INF/lib which is not on
the class path.

 Could the classes within the expanded
 JAR folder
 be loaded by the web application class loader?

Which part of WEB-INF/lib is only ever scanned for JARs. Everything
else is ignored. did you not understand?


 I see the logic behind the guess but it is wrong. This option won't work for
 either of those directories.

 
 And which directories/classpath  the document indicates when it saying If
 true, any directories found on the classpath will be checked to see if they
 are expanded JAR files , if it won't work for either of those
 directories?

As per the docs, scanAllDirectories applies to directories found on the
class path not to WEB-INF/lib since it is not on the class path.
(WEB-INF/lib/*.jar is on the class path and that is not a directory).

Mark


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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-17 Thread Nan Ge


 Which part of WEB-INF/lib is only ever scanned for JARs. Everything
 else is ignored. did you not understand?


 Yes, I see that only WEB-INF/lib/*.jar files are scanned.


  And which directories/classpath  the document indicates when it saying
 If
  true, any directories found on the classpath will be checked to see if
 they
  are expanded JAR files , if it won't work for either of those
  directories?

 As per the docs, scanAllDirectories applies to directories found on the
 class path not to WEB-INF/lib since it is not on the class path.
 (WEB-INF/lib/*.jar is on the class path and that is not a directory).

 And for WEB-INF/classes, only unpacked classes and resources(without any
top-level non-package-name directories) are accepted, an expanded JAR
file is not accepted here. The difference between unpacked classes and
 expanded JAR file is whether there is a top-level folder outside plus a
sibling META-INF folder beside the unpacked classes, is it right?
Then where else should I put an expanded JAR file, except WEB-INF/lib
and WEB-INF/classes? How to define the class path?
I will be very appreciative if any of you could give me an example to
illustrate the usage of scanAllDirectories and  expanded JAR file.

Regards,
Nan


Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-16 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

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
-BEGIN PGP SIGNATURE-
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUkHNHAAoJEBzwKT+lPKRYQDAP/jkHJMhYEGRhJxOGsS7VRSye
fWi/LIar5FChw9EEeuLQJ80V8HKYNTOzjSPB++usPZjlnmCtlZhRYJN/kLq4Dl3m
tRtW49d+o3JSlRtMTWfCCCmi5r/aE0WnyOuapyccj5145+bQLrDfJx8LW7p5KeO0
XK3MbWYdgynjmsv1r+jD6PZN+T2+sHu6aGYipkNUmtV5Zq+HcSZ0RAnr3JYLl/Kp
nKCExH7ePrrHjbCu+B+FHIe8G7lXUYVMVCavCenveUDtAaDLf/ubWjSLhUIwLpRm
YOtzly0z9IhWVTGWr+rWqOYaT1g2HHdx+2bqm0xOaRTbmtOOzs4TljpVXDa6QkO1
nR+twa6o63cpl4p5nvvSzCk7P3E4evtcvIsMBcI7MJ7khH5yHTiNXRa80QTnFJVS
5O62rcF/0m5j9LP5kMLKqjfaGJc9R5hFgmQB0l0aN70wiisiaMZYD96AUMjA2rzE
/Fp4t3QWKwRatuByW6apBda0R4VPOY4V3trMpji8lTV6cGiDUm5OoYMK37f1wzDE
LtDs2ZAQ/vg1ujl85AhoL5vr20eNaafHRfnOXvL0IooHdbTr9xPrfXLxDanl7Jdj
3PeBN9dXTpGeb38HHcfqBb3k+/me9RI6V6bIleIU2ZvVxXGdm/FWgwZFbXiJE38s
sju716CMKTzjrg/vuqu1
=QNX0
-END PGP SIGNATURE-

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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-16 Thread Mark Thomas
On 16/12/2014 18:00, Christopher Schultz 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 see the logic behind the guess but it is wrong. This option won't work
for either of those directories.

Mark

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



Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-16 Thread Nan Ge
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


Re: About scanAllDirectories,JarScanner and expanded JAR

2014-12-16 Thread Nan Ge
On Wed, Dec 17, 2014 at 2:43 AM, Mark Thomas ma...@apache.org wrote:

 On 16/12/2014 18:00, Christopher Schultz 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 see the logic behind the guess but it is wrong. This option won't work
 for either of those directories.
 ?
 Mark

 Thanks Mark!

Then how to make this 'scanAllDirectories' attribute work, or do you mean
it has been discarded in Tomcat8.0 ?

Nan