-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Kenneth,

On 5/23/13 12:57 PM, Kenneth Erard wrote:
> ------------------
> 
> We need to use all JAR files from this directory but Tomcat ignore
> this syntax (notwithstanding previous version runs correctly) and
> it "understand" only exact JAR definition, for example -classpath 
> /opt/tomcat/lib/tomcat-api.jar,/opt/tomcat/lib/tomcat-api.jar,/opt/tomcat/lib/tomcat-util.jar,...
>
> 
Where could be a cause of this problem? Why this version of Tomcat
> ignore string -classpath /opt/tomcat/lib?
> 
> ------------------
> 
> 
> I'm not sure!  I'm actually quite new to Tomcat, and don't have an 
> answer.  I previously tried a pattern match (ex: 
> CLASSPATH=/opt/classes/*.jar or CLASSPATH=/opt/myclasses/*.*)
> without success, then switched to loading specific JAR files.  Your
> problem was exactly what I had experienced with JSVC before I made
> the switch -- "no classes found".  Once I explicitly declared my
> JAR files, JSVC was happy.
> 
> 
> Perhaps someone with deeper knowledge of Tomcat and JSVC has an
> answer.

This has nothing to do with Tomcat, jsvc, or Java at all. Instead, it
is a misunderstanding of how shell wildcard-expansion is done.

If you say "export CLASSPATH=lib/*.jar" on a *NIX system, you'll get
the "CLASSPATH" environment variable set to a value like this:

$ export FOO=lib/*.jar
$ echo $FOO
lib/annotations-api.jar lib/catalina-ant.jar lib/catalina-ha.jar
lib/catalina-tribes.jar lib/catalina.jar lib/ecj-4.2.1.jar
lib/el-api.jar lib/jasper-el.jar lib/jasper.jar lib/jsp-api.jar
lib/mysql-connector-java-5.1.24-bin.jar lib/servlet-api.jar
lib/tomcat-api.jar lib/tomcat-coyote.jar lib/tomcat-dbcp.jar
lib/tomcat-i18n-es.jar lib/tomcat-i18n-fr.jar lib/tomcat-i18n-ja.jar
lib/tomcat-jdbc.jar lib/tomcat-util.jar

(If you do "set CLASSPATH=lib\*.jar" on a win32 system, you'll get
CLASSPATH set to "lib\*.jar" because on Windows, the shell doesn't do
any expansion: that job is stupidly left up to the individual programs
to handle.)

A proper CLASSPATH variable needs to have the form
"resource:resource:resource" and not "resource resource resource"
which is what you have above.

The short answer is that you cannot rely on shell-expansion in order
to collect all JAR files in a directory. Instead, you have to build
the CLASSPATH piece-by-piece, like this:

# Build the classpath to include lib/*.jar
CLASSPATH=""
for jar in "${BASE_DIR}/lib"/*.jar ; do
   CLASSPATH="${CLASSPATH}:$jar"
done

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRno+dAAoJEBzwKT+lPKRY1YgP/0vRVudz3R5G4MZmit6OMEMF
uLGYVEiSrXCbLZOyiY8E1cL+j5weWFqTH+WCc1FntUoCL7pCvAGDHDKaVitZvbJl
/UKb1b730T8yOSpq8M3IBCIRHtFvwT9yWkulWj4l5jSb9Oktm/UIlh+iFnWmuB1i
GTx4Q72Ualy40njxCzPCpNjkiobqZiyKGVUK5Sf7OAMHLs39/7FLbz43Rwv5qfB1
II9scX4+LttdfcKduIE4Fvn9fD824th3jC4o9NADGjybkKLYUoa6lXcipnuaWitK
iSoynn/pJYASRX4soWvuaDPNht2YxmKRhlM7dWHyxn0p8YXAcG+6iXqlnXiNiTVU
RtNqi8xetInmjQo8pRC4yINFFHYGJlqhoIXCFfjvoHiaBzsafIb/5WvwA2lQq0jk
iYq0UqMIxr3FAUSlZEhj292u4oLD6W5qbd785pGUvvzD8V+bJJFzrxEf1v37x76D
aoLHG565SAO5VhvGY2S7K+GQ8QbLJdyls5x8QzSn3aTZdRk3vRJuDfr7DlY7IDrC
XrTC15fkTnZomEPUEGt1DRFXPYKj9+/UTh2Bk4qkxetcKCougF6iKCjENPSdZ7oG
AQ+sY7lmXS7F5Q9cl3EE1pbUqMyjnYRT16JYtehQJz8BOKpnQ/mRv1/sTsSp95FT
lEiNb8AhnWslzmLBF71m
=ChqK
-----END PGP SIGNATURE-----

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

Reply via email to