tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: war file extraction issues in tomcat 5.5
Date Wed, 11 Jul 2012 01:33:45 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rajesh,

On 7/10/12 2:56 AM, Rajesh Kumar wrote:
> I am finding many issues in it but still not able to resolve this.
> Is there any expert opinion on this... I have this setup in
> Cpanel.
> 
> I have added export JAVA_OPTS="-XX:PermSize=128M
> -XX:MaxPermSize=524M" in catlina.sh but dint help.

As Mark Eggers says, these settings are not relevant. All comments he
makes about them are spot-on: move to startup.sh, use CATALINA_OPTS,
and you probably meant -Xms and -Xmx, though some people really do
need a huge PermGen. Are you sure you're one of them?

> SEVERE: Exception fixing docBase: {0} 
> java.io.FileNotFoundException: 
> /home/surgnet/public_html/sample/META-INF/MANIFEST.MF (No such file
> or directory) at java.io.FileOutputStream.open(Native Method) at
> java.io.FileOutputStream.<init>(FileOutputStream.java:194) at
> java.io.FileOutputStream.<init>(FileOutputStream.java:145) at
> org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:457)

ExpandWar.expand is trying to write to the file
/home/surgnet/public_html/sample/META-INF/MANIFEST.MF and it can't:
"No such file or directory" is a stupid exception message. What it
really means is that the parent directory
(/home/surgnet/public_html/sample/META-INF/) does not exist. Try a
simple test like this and you'll see you get the same exception message:

import java.io.*;

public class FileTest
{
  public static void main(String[] args)
    throws Exception
  {
    File file = new File("./nosuchdir/a_file");
    new FileOutputStream(file);
  }
}

So, the problem is that the parent directory doesn't exist. Why? Well,
ExpandWar.expand, on line 165 does this:

161	int last = name.lastIndexOf('/');
162 	if (last >= 0) {
163	 	File parent = new File(docBase,
164	 	name.substring(0, last));
165	 	parent.mkdirs();
166 	}

There is no check of the return value of parent.mkdirs(), which can
fail with no exception (part of the charm of the java.io package:
sometimes you get an exception and sometimes you don't).

Technically, one could argue that this is a bug in Tomcat (which I
will log, though it will probably not be fixed since it isn't serious
enough to warrant a fix to a Tomcat version which is in
maintenance-mode -- that is, one that really only gets security
updates) because the return value of File.mkdirs should really be
checked for false which indicates a problem. Then, an exception could
be thrown that says "I can't create [parent dir]" and bombs, so you
don't get the stupid FileNotFoundException.

At any rate, I highly suspect that this is a file-permissions error:
can your Tomcat user write to the /home/surgnet/public_html/sample/
directory? Remember that the user will require both write *and*
execute privileges to really use a directory on a *NIX filesystem.

> SEVERE: Exception fixing docBase: {0} 
> java.io.FileNotFoundException: 
> /home/surgnet/public_html/surgeryplanet/META-INF/MANIFEST.MF (No
> such file or directory) at java.io.FileOutputStream.open(Native
> Method) at
> java.io.FileOutputStream.<init>(FileOutputStream.java:194) at
> java.io.FileOutputStream.<init>(FileOutputStream.java:145) at
> org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:457) at
> org.apache.catalina.startup.ExpandWar.expand(ExpandWar.java:173)

This is certainly the same error.

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

iEYEARECAAYFAk/81/kACgkQ9CaO5/Lv0PDotACff+q6Z13Q4ofUK9iyQwqjdvWF
y8oAoKQCEe3ylZe2a3zD7+mGH92vZC2s
=Ohgw
-----END PGP SIGNATURE-----

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


Mime
View raw message