Hi Horacio,

I get similar problems (on debian woody) for the deployment of jar-files.

When I start tomcat (with jsvc) everythings fine and the webapp is
startet.
But I would like to unload and load the application with the manager
application. In this case the start of the webapp fails, because
tomcat cannot copy the jar-files (jstl beeing the first of them) into
work/Standalone/localhost/<webapp>/WEB-INF/lib
because it didn't create that dir.

I did a strace analysis which shows, that tomcat
- checks for the existance of .../localhost/<webapp>/WEB-INF/lib
- tries to create this directory and fails (No such file or directory)
  (because .../localhost/<webapp>/WEB-INF does not exist)
- checks all paths up to .../localhost/<webapp>/WEB-INF
- finds that the path up to .../localhost/<webapp> exits
  and .../localhost/<webapp>/WEB-INF is missing
- ignores this and tries to open the jar-File (for writing)
  This fails and an IOException is thrown

mkdir("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search",
 0777) = 0
gettimeofday({1089624365, 625731}, NULL) = 0
write(21, "2004-07-12 11:26:05 StandardCont"..., 90) = 90
gettimeofday({1089624365, 626281}, NULL) = 0
write(21, "2004-07-12 11:26:05 WebappLoader"..., 180) = 180
gettimeofday({1089624365, 626677}, NULL) = 0
gettimeofday({1089624365, 626855}, NULL) = 0
stat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF/lib",
 0xbbffe43c) = -1 ENOENT (No such file or directory)
mkdir("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF/lib",
 0777) = -1 ENOENT (No such file or directory)
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 
0lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30", {st_mode=S_IFDIR|0775, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work", {st_mode=S_IFDIR|0755, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search",
 {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF",
 0xbbffc394) = -1 ENOENT (No such file or directory)
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30", {st_mode=S_IFDIR|0775, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work", {st_mode=S_IFDIR|0755, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search",
 {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF",
 0xbbffc394) = -1 ENOENT (No such file or directory)
gettimeofday({1089624365, 629834}, NULL) = 0
write(21, "2004-07-12 11:26:05 WebappLoader"..., 190) = 190
open("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF/lib/jstl.jar",
 O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = -1 ENOENT (No such file or directory)


Without jsvc it looks pretty much the same, except that the directory is 
created as expected.

mkdir("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search",
 0777) = 0
gettimeofday({1089625315, 938740}, NULL) = 0
write(22, "2004-07-12 11:41:55 StandardCont"..., 90) = 90
gettimeofday({1089625315, 939285}, NULL) = 0
write(22, "2004-07-12 11:41:55 WebappLoader"..., 180) = 180
gettimeofday({1089625315, 939650}, NULL) = 0
gettimeofday({1089625315, 939830}, NULL) = 0
stat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF/lib",
 0xbbffe43c) = -1 ENOENT (No such file or directory)
mkdir("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF/lib",
 0777) = -1 ENOENT (No such file or directory)
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30", {st_mode=S_IFDIR|0775, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work", {st_mode=S_IFDIR|0755, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search",
 {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF",
 0xbbffc394) = -1 ENOENT (No such file or directory)
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30", {st_mode=S_IFDIR|0775, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work", {st_mode=S_IFDIR|0755, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search",
 {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF",
 0xbbffc394) = -1 ENOENT (No such file or directory)
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30", {st_mode=S_IFDIR|0775, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work", {st_mode=S_IFDIR|0755, 
st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost", 
{st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
lstat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search",
 {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
gettimeofday({1089625315, 943561}, NULL) = 0
stat64("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF",
 0xbbffe40c) = -1 ENOENT (No such file or directory)
mkdir("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF",
 0777) = 0
mkdir("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF/lib",
 0777) = 0
gettimeofday({1089625315, 944311}, NULL) = 0
write(22, "2004-07-12 11:41:55 WebappLoader"..., 190) = 190
open("/usr/tanto/www/servers/jakarta-tomcat-4.1.30/work/Standalone/localhost/refdb_search/WEB-INF/lib/jstl.jar",
 O_WRONLY|O_CREAT|O_TRUNC|O_LARGEFILE, 0666) = 23


But I don't see any reason, why the mkdir is left out, when running with
jsvc.

The java-source for this seems to be (WebappLoader.java ~ line 1061)
            File destDir = null;

            if (absoluteLibPath != null) {
                destDir = new File(absoluteLibPath);
            } else {
                copyJars = true;
                destDir = new File(workDir, libPath);
                destDir.mkdirs();
            }

            // Looking up directory /WEB-INF/lib in the context
            try {
                NamingEnumeration enum = resources.listBindings(libPath);
                while (enum.hasMoreElements()) {

                    Binding binding = (Binding) enum.nextElement();
                    String filename = libPath + "/" + binding.getName();
                    if (!filename.endsWith(".jar"))
                        continue;

                    // Copy JAR in the work directory, always (the JAR file
                    // would get locked otherwise, which would make it
                    // impossible to update it or remove it at runtime)
                    File destFile = new File(destDir, binding.getName());

                    log(sm.getString("webappLoader.jarDeploy", filename,
                                     destFile.getAbsolutePath()));

                    Resource jarResource = (Resource) binding.getObject();
                    if (copyJars) {
                        if (!copy(jarResource.streamContent(),
                                  new FileOutputStream(destFile)))
                            continue;
                    }

                    JarFile jarFile = new JarFile(destFile);
                    classLoader.addJar(filename, jarFile, destFile);

                }

so the directory should just be created with destDir.mkdirs().
How can this fail?

I'm using 
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

daemon 1.0
tomcat 4.1.30
on debian woody. The target system where this fails also is some suse
linux. Unfortunately I don't have direct access to this system yet.

Horacios question showed me that this is a problem on debian woody also.

Morus

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to