You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Horacio de Oro <ho...@trimaxcba.com> on 2004/07/12 07:59:18 UTC
tomcat doesn't create directories under 'work' but does create .java/.class
files
Hi! What a subject!
I've trying to make work starting up Tomcat with jsvc.
On Debian unstable, this works ok.
On Debian stable (woody), I could startup Tomcat, but when I try to
access to a JSP file, I get the classic exception:
2004-07-12 02:03:58 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
java.io.FileNotFoundException:
/home/horacio/tomcat-pruebas-startup/jakarta-tomcat-5.0.25/work/Catalina/localhost/prueba/org/apache/jsp/test_jsp.java
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:188)
This isn't a permission problems, I've checked them a hundred times,
I've excecute 'chown -R USER.USER jakarta-tomcat-dir' many times too.
I've follow the instructions on Tomcat FAQ, and I've tryed
http://jakarta.apache.org/tomcat/faq/misc.html#commonsLoggingLog4j
http://marc.theaimsgroup.com/?l=tomcat-user&m=108330970225012&w=2
http://marc.theaimsgroup.com/?l=tomcat-user&m=108578233003073&w=2
and couldn't make it work on Debian stable (woody).
I was looking at 'generateJava()' on file
org.apache.jasper.compiler.Compiler.java (line 188), this is what make
the exception:
try {
osw = new OutputStreamWriter( // <- LINE 188
new FileOutputStream(javaFileName), javaEncoding);
} catch (UnsupportedEncodingException ex) {
errDispatcher.jspError("jsp.error.needAlternateJavaEncoding",
javaEncoding);
}
So, I make a little java program using FileOutputStream.
public static void main(String[] args) throws Exception {
FileOutputStream fos = new
FileOutputStream("/tmp/dir/that/doesnt/exist/test.txt");
byte test[] = new byte[1024];
fos.write(test);
fos.close();
}
Since "/tmp/dir/that/doesnt/exist" doesn't existe, I get the exact same
exception:
java.io.FileNotFoundException:
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
And then, I've tried to make the directories that Tomcat needs to make
the temporary .java, so I do:
mkdir -p
/home/horacio/tomcat-pruebas-startup/jakarta-tomcat-5.0.25/work/Catalina/localhost/prueba/org/apache/jsp
and then, reloaded the page, and this work!!!!!
So, the only problem is that Tomcat doesn't make the proper directory
structure where it should put the generated .java...
So:
- If I run Tomcat from "startup.sh" -> WORKS
- If I run Tomcat from "jsvc" on UNSTABLE -> WORKS
- If I run Tomcat from "jsvc" on STABLE -> DOESN'T WORKS
ON DEBIAN UNSTABLE:
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)
ON DEBIAN STABLE:
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
ALSO ON DEBIAN STABLE:
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)
Tomcat 5.0.25
Is this a bug?
How can I make work Tomcat on Debian stable with jsvc?
Thanks in advance!
Horacio de Oro
*********
Full error message from tomcat's logs.
2004-07-12 02:03:58 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
java.io.FileNotFoundException:
/home/horacio/tomcat-pruebas-startup/jakarta-tomcat-5.0.25/work/Catalina/localhost/prueba/org/apache/jsp/test_jsp.java
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
at
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:188)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:461)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:442)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:430)
at
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:793)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644)
at java.lang.Thread.run(Thread.java:534)
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: tomcat doesn't create directories under 'work' but does create .java/.class
files
Posted by Morus Walter <mo...@tanto.de>.
Hi,
First of all apologies to everyone for sending my last message thrice.
Wasn't intentional and I'll do my best not to repeat that...
> File destDir = null;
>
> if (absoluteLibPath != null) {
> destDir = new File(absoluteLibPath);
> } else {
> copyJars = true;
> destDir = new File(workDir, libPath);
> destDir.mkdirs();
> }
>
I compiled tomcat from sources and added some debugging messages.
What I found is, that tomcat takes the else-branch which should create
the directory.
I changed this to
} else {
copyJars = true;
System.err.println("WorkDir: " + workDir + "; libPath: " + libPath);
destDir = new File(workDir, libPath);
System.err.println("no absoluteLibPath; dest Dir: " + destDir);
destDir.mkdirs();
if ( !destDir.exists() ) {
System.err.println("destDir " + destDir + " does not exist");
destDir.getParentFile().mkdirs();
destDir.mkdirs();
if ( !destDir.exists() ) {
System.err.println("destDir " + destDir + " does not exist");
}
else {
System.err.println("destDir " + destDir + " does exist");
}
}
}
and it works. After the first destDir.mkdirs() destDir does not exist,
the second (two) mkdirs calls create it.
So this really seems to be some bug in javas File.mkdirs implementation
(or in the underlying libc/linux filesystem).
I'm not sure what's the best thing to do in this situation, but I'll file
a bug report for tomcat suggesting to add
if ( !destDir.exists() ) {
destDir.getParentFile().mkdirs();
destDir.mkdirs();
}
with an apropriate comment as a workaround...
Morus
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: tomcat doesn't create directories under 'work' but does create .java/.class
files
Posted by Morus Walter <mo...@tanto.de>.
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: tomcat doesn't create directories under 'work' but does create .java/.class
files
Posted by Morus Walter <mo...@tanto.de>.
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: File.mkdirs() don't work if started with jsvc
Posted by Morus Walter <mo...@tanto.de>.
Horacio de Oro writes:
> Tomcat started with jsvc:
>
> fileName = "/tmp/test/something" => DOESN'T WORKS
> fileName = "/tmp/onedir" => THIS WORKS!!!
>
> So, the problem is: Tomcat started with jsvc on Debian Woody:
> - File.mkdirs() WORKS if it should make ONE directory.
> - File.mkdirs() DOESN'T WORKS if it should make MORE THAN ONE directory.
>
If you ask me, this is a java problem not a tomcat problem.
I did another test: I extended the daemon sample 'SimpleDaemon' to
create directories /tmp/bla/fasel and /tmp/blub using mkdirs
(just after the line
System.err.println("SimpleDaemon: started acceptor loop");
I added
new File("/tmp/bla/fasel").mkdirs();
new File("/tmp/blub").mkdirs();
)
/tmp/bla/fasel is not created /tmp/blub is.
So tomcat doesn't seem to be involved in the failure.
IMO the bug is either in java itself or in daemon.
And it must be some weird interaction with system libraries (pthread, libc)
since it occurs only on some systems.
After some further search I decided to look at javas and jsvc libraries
and the only difference is, java uses libpthread, jsvc doesn't.
If one changes that (that is adds -lpthread to the linking of jsvc in
daemon-1.0/src/native/unix/native/Makefile (that's autogenerated, but
I didn't want to search through the autoconf/automake stuff for the correct
place)
jsvc: jsvc-unix.o libservice.a
$(LDCMD) $(LDFLAGS) jsvc-unix.o libservice.a -lpthread -o ../jsvc
instead of
jsvc: jsvc-unix.o libservice.a
$(LDCMD) $(LDFLAGS) jsvc-unix.o libservice.a -o ../jsvc
the problem disapears. :-)
So the origin of the problem is somewhere in the details of debian woodys
libc/libpthread.
I filed a bug report for commons daemon.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30177
Morus
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: File.mkdirs() don't work if started with jsvc
Posted by Horacio de Oro <ho...@trimaxcba.com>.
QM wrote:
> On Fri, Jul 16, 2004 at 02:45:27PM -0300, Horacio de Oro wrote:
> : I was trying File.mkdirs() on Tomcat 5.0.25 on Debian Woody, and I can
> : say File.mkdirs() don't work if Tomcat is started with jsvc.
>
> Step 1: perms issue?
>
I'm sure it isn't a permissions problem... All the users have write
access to "/tmp"... That's because I choose /tmp. And everytime I made
the tests, I checked that no /tmp/test directory exist.
And I start tomcat with the SAME user, whenever using "startup.sh" or
"jsvc".
>
> : String fileName = "/tmp/test/" +
> : System.currentTimeMillis() +
> : "/test/afile.txt";
> :
>
> Step 2: I don't recall, offhand, whether mkdir() will create a full path
> of directories, filling in nonexistent ones as you go.
>
From http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html#mkdirs()
(...)
Creates the directory named by this abstract pathname, including any
necessary but nonexistent parent directories. Note that if this
operation fails it may have succeeded in creating some of the necessary
parent directories.
(...)
> What about
>
> fileName = "/tmp/test/"
>
> ?
>
Tomcat started with jsvc:
fileName = "/tmp/test/something" => DOESN'T WORKS
fileName = "/tmp/onedir" => THIS WORKS!!!
So, the problem is: Tomcat started with jsvc on Debian Woody:
- File.mkdirs() WORKS if it should make ONE directory.
- File.mkdirs() DOESN'T WORKS if it should make MORE THAN ONE directory.
Thanks for your response!
Horacio
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: File.mkdirs() don't work if started with jsvc
Posted by QM <qm...@brandxdev.net>.
On Fri, Jul 16, 2004 at 02:45:27PM -0300, Horacio de Oro wrote:
: I was trying File.mkdirs() on Tomcat 5.0.25 on Debian Woody, and I can
: say File.mkdirs() don't work if Tomcat is started with jsvc.
Step 1: perms issue?
: String fileName = "/tmp/test/" +
: System.currentTimeMillis() +
: "/test/afile.txt";
:
Step 2: I don't recall, offhand, whether mkdir() will create a full path
of directories, filling in nonexistent ones as you go.
What about
fileName = "/tmp/test/"
?
-QM
--
software -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: File.mkdirs() don't work if started with jsvc
Posted by Horacio de Oro <ho...@trimaxcba.com>.
Hi again!
I was trying File.mkdirs() on Tomcat 5.0.25 on Debian Woody, and I can
say File.mkdirs() don't work if Tomcat is started with jsvc.
(I've to say that this happens ONLY on Debian Woody... Debian Sarge and
Debian Sid works ok).
I've made a simple servlet (since Tomcat can't compile JSP):
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet</title>");
out.println("</head>");
try {
String fileName = "/tmp/test/" +
System.currentTimeMillis() +
"/test/afile.txt";
out.println("File name: " + fileName + "<br>");
File file = new File(fileName);
boolean ok = file.mkdirs();
if(ok)
out.println("OK<br>");
else
out.println("FAIL without exception!<br>");
} catch(Exception e) {
out.println("FAIL with exception!<br>");
out.println("<pre>");
StackTraceElement el[] = e.getStackTrace();
out.println(e.getMessage());
for(int i=0; i<el.length; i++) {
out.print(" ");
out.println(el[i].toString());
}
out.println("</pre>");
}
out.println("<body>");
out.println("</body>");
out.println("</html>");
out.close();
}
If I start Tomcat with "startup.sh", I get:
============================================================
File name: /tmp/test/1089999282783/test/afile.txt
OK
============================================================
If I start Tomcat with "jsvc", I get:
============================================================
File name: /tmp/test/1089999639863/test/afile.txt
FAIL without exception!
============================================================
I'll post whis message on tomcat-user and commons-user, because maybe
this could be a jsvc related problem
Thanks in advance!
Horacio
FYI: # java -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
PS: here is my original post:
Horacio de Oro wrote:
> Hi! What a subject!
>
> I've trying to make work starting up Tomcat with jsvc.
> On Debian unstable, this works ok.
> On Debian stable (woody), I could startup Tomcat, but when I try to
> access to a JSP file, I get the classic exception:
>
> 2004-07-12 02:03:58 StandardWrapperValve[jsp]: Servlet.service() for
> servlet jsp threw exception
> java.io.FileNotFoundException:
> /home/horacio/tomcat-pruebas-startup/jakarta-tomcat-5.0.25/work/Catalina/localhost/prueba/org/apache/jsp/test_jsp.java
>
> at java.io.FileOutputStream.open(Native Method)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
> at
> org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:188)
>
> This isn't a permission problems, I've checked them a hundred times,
> I've excecute 'chown -R USER.USER jakarta-tomcat-dir' many times too.
>
> I've follow the instructions on Tomcat FAQ, and I've tryed
> http://jakarta.apache.org/tomcat/faq/misc.html#commonsLoggingLog4j
> http://marc.theaimsgroup.com/?l=tomcat-user&m=108330970225012&w=2
> http://marc.theaimsgroup.com/?l=tomcat-user&m=108578233003073&w=2
>
> and couldn't make it work on Debian stable (woody).
>
> I was looking at 'generateJava()' on file
> org.apache.jasper.compiler.Compiler.java (line 188), this is what make
> the exception:
>
> try {
> osw = new OutputStreamWriter( // <- LINE 188
> new FileOutputStream(javaFileName), javaEncoding);
>
> } catch (UnsupportedEncodingException ex) {
> errDispatcher.jspError("jsp.error.needAlternateJavaEncoding",
> javaEncoding);
> }
>
> So, I make a little java program using FileOutputStream.
>
> public static void main(String[] args) throws Exception {
> FileOutputStream fos = new
> FileOutputStream("/tmp/dir/that/doesnt/exist/test.txt");
> byte test[] = new byte[1024];
> fos.write(test);
> fos.close();
> }
>
> Since "/tmp/dir/that/doesnt/exist" doesn't existe, I get the exact same
> exception:
>
> java.io.FileNotFoundException:
> at java.io.FileOutputStream.open(Native Method)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
>
>
>
> And then, I've tried to make the directories that Tomcat needs to make
> the temporary .java, so I do:
>
> mkdir -p
> /home/horacio/tomcat-pruebas-startup/jakarta-tomcat-5.0.25/work/Catalina/localhost/prueba/org/apache/jsp
>
>
> and then, reloaded the page, and this work!!!!!
>
> So, the only problem is that Tomcat doesn't make the proper directory
> structure where it should put the generated .java...
>
> So:
> - If I run Tomcat from "startup.sh" -> WORKS
> - If I run Tomcat from "jsvc" on UNSTABLE -> WORKS
> - If I run Tomcat from "jsvc" on STABLE -> DOESN'T WORKS
>
> ON DEBIAN UNSTABLE:
> 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)
>
> ON DEBIAN STABLE:
> java version "1.4.2"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
> Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
>
> ALSO ON DEBIAN STABLE:
> 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)
>
> Tomcat 5.0.25
>
> Is this a bug?
> How can I make work Tomcat on Debian stable with jsvc?
>
> Thanks in advance!
>
> Horacio de Oro
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: [Daemon] File.mkdirs() don't work if started with jsvc
Posted by Horacio de Oro <ho...@trimaxcba.com>.
Kees Jongenburger wrote:
> On Friday 16 July 2004 07:49 pm, Horacio de Oro wrote:
>
>>Hi again!
>>
>>I was trying File.mkdirs() on Tomcat 5.0.25 on Debian Woody, and I can
>>say File.mkdirs() don't work if Tomcat is started with jsvc.
>>
>>(I've to say that this happens ONLY on Debian Woody... Debian Sarge and
>>Debian Sid works ok).
>
>
> Hi . if you have installed tomcat using apt-get it might just be the security settings that debian developers
> like to add to tomcat. Have you tried to download tomcat and insall by hand?
> (editing /etc/tomcatthingy) does not work since they also used to override those files every startup
>
>
Hi!
I've installed tomcat from "jakarta-tomcat-5.0.25.tar.gz"...
On "jsvc-src/native/jsvc-unix.c":
/* Set linux capability, user and group */
#ifdef OS_LINUX
/* CAPSALL is to allow to read/write at any location */
#define CAPSALL (1 << CAP_NET_BIND_SERVICE)+ \
(1 << CAP_SETUID)+ \
(1 << CAP_SETGID)+ \
(1 << CAP_DAC_READ_SEARCH)+ \
(1 << CAP_DAC_OVERRIDE)
#define CAPSMAX (1 << CAP_NET_BIND_SERVICE)+ \
(1 << CAP_DAC_READ_SEARCH)+ \
(1 << CAP_DAC_OVERRIDE)
/* That a more reasonable configuration */
#define CAPS (1 << CAP_NET_BIND_SERVICE)+ \
(1 << CAP_SETUID)+ \
(1 << CAP_SETGID)
/* probably the only one Java could use */
#define CAPSMIN (1 << CAP_NET_BIND_SERVICE)
I don't understand how to use "capabilities"... Could be some problem
related with capabilities??? (since the error apears ONLY if I start
Tomcat with jsvc)
Horacio
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [Daemon] File.mkdirs() don't work if started with jsvc
Posted by Kees Jongenburger <ke...@dds.nl>.
On Friday 16 July 2004 07:49 pm, Horacio de Oro wrote:
> Hi again!
>
> I was trying File.mkdirs() on Tomcat 5.0.25 on Debian Woody, and I can
> say File.mkdirs() don't work if Tomcat is started with jsvc.
>
> (I've to say that this happens ONLY on Debian Woody... Debian Sarge and
> Debian Sid works ok).
Hi . if you have installed tomcat using apt-get it might just be the security settings that debian developers
like to add to tomcat. Have you tried to download tomcat and insall by hand?
(editing /etc/tomcatthingy) does not work since they also used to override those files every startup
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [Daemon] File.mkdirs() don't work if started with jsvc
Posted by Horacio de Oro <ho...@trimaxcba.com>.
Michael McGrady wrote:
> At 10:49 AM 7/16/2004, you wrote:
>
>> (I've to say that this happens ONLY on Debian Woody... Debian Sarge and
>> Debian Sid works ok).
>
> Try getting ird of the hard coded separators, i.e. "/", with
> File.separator, e.g. File.separator + "tmp" + File.separtor + "test+
> File.separator instead of "/tmp/test/". Don't do this with the content
> types, by the way. If you want to be OS free, you have to code OS free.
>
> Michael
>
>
Hi Michael!
With:
String fileName = File.separator + "tmp" +
File.separator + "test" +
File.separator + System.currentTimeMillis() +
File.separator + "test" +
File.separator + "lastDir";
I get:
======================================================
File name: /tmp/test/1090002159068/test/lastDir
FAIL without exception!
======================================================
The same problem! File.mkdirs() doesn't work!
Horacio
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [Daemon] File.mkdirs() don't work if started with jsvc
Posted by Michael McGrady <mi...@michaelmcgrady.com>.
At 10:49 AM 7/16/2004, you wrote:
>(I've to say that this happens ONLY on Debian Woody... Debian Sarge and
>Debian Sid works ok).
Try getting ird of the hard coded separators, i.e. "/", with
File.separator, e.g. File.separator + "tmp" + File.separtor + "test+
File.separator instead of "/tmp/test/". Don't do this with the content
types, by the way. If you want to be OS free, you have to code OS free.
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
[Daemon] File.mkdirs() don't work if started with jsvc
Posted by Horacio de Oro <ho...@trimaxcba.com>.
Hi again!
I was trying File.mkdirs() on Tomcat 5.0.25 on Debian Woody, and I can
say File.mkdirs() don't work if Tomcat is started with jsvc.
(I've to say that this happens ONLY on Debian Woody... Debian Sarge and
Debian Sid works ok).
I've made a simple servlet (since Tomcat can't compile JSP):
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet</title>");
out.println("</head>");
try {
String fileName = "/tmp/test/" +
System.currentTimeMillis() +
"/test/afile.txt";
out.println("File name: " + fileName + "<br>");
File file = new File(fileName);
boolean ok = file.mkdirs();
if(ok)
out.println("OK<br>");
else
out.println("FAIL without exception!<br>");
} catch(Exception e) {
out.println("FAIL with exception!<br>");
out.println("<pre>");
StackTraceElement el[] = e.getStackTrace();
out.println(e.getMessage());
for(int i=0; i<el.length; i++) {
out.print(" ");
out.println(el[i].toString());
}
out.println("</pre>");
}
out.println("<body>");
out.println("</body>");
out.println("</html>");
out.close();
}
If I start Tomcat with "startup.sh", I get:
============================================================
File name: /tmp/test/1089999282783/test/afile.txt
OK
============================================================
If I start Tomcat with "jsvc", I get:
============================================================
File name: /tmp/test/1089999639863/test/afile.txt
FAIL without exception!
============================================================
I'll post whis message on tomcat-user and commons-user, because maybe
this could be a jsvc related problem
Thanks in advance!
Horacio
FYI: # java -version
java version "1.4.2_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_05-b04)
Java HotSpot(TM) Client VM (build 1.4.2_05-b04, mixed mode)
PS: here is my original post on tomcat-user:
Horacio de Oro wrote:
> Hi! What a subject!
>
> I've trying to make work starting up Tomcat with jsvc.
> On Debian unstable, this works ok.
> On Debian stable (woody), I could startup Tomcat, but when I try to
> access to a JSP file, I get the classic exception:
>
> 2004-07-12 02:03:58 StandardWrapperValve[jsp]: Servlet.service() for
> servlet jsp threw exception
> java.io.FileNotFoundException:
> /home/horacio/tomcat-pruebas-startup/jakarta-tomcat-5.0.25/work/Catalina/localhost/prueba/org/apache/jsp/test_jsp.java
>
> at java.io.FileOutputStream.open(Native Method)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
> at
> org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:188)
>
> This isn't a permission problems, I've checked them a hundred times,
> I've excecute 'chown -R USER.USER jakarta-tomcat-dir' many times too.
>
> I've follow the instructions on Tomcat FAQ, and I've tryed
> http://jakarta.apache.org/tomcat/faq/misc.html#commonsLoggingLog4j
> http://marc.theaimsgroup.com/?l=tomcat-user&m=108330970225012&w=2
> http://marc.theaimsgroup.com/?l=tomcat-user&m=108578233003073&w=2
>
> and couldn't make it work on Debian stable (woody).
>
> I was looking at 'generateJava()' on file
> org.apache.jasper.compiler.Compiler.java (line 188), this is what make
> the exception:
>
> try {
> osw = new OutputStreamWriter( // <- LINE 188
> new FileOutputStream(javaFileName), javaEncoding);
>
> } catch (UnsupportedEncodingException ex) {
> errDispatcher.jspError("jsp.error.needAlternateJavaEncoding",
> javaEncoding);
> }
>
> So, I make a little java program using FileOutputStream.
>
> public static void main(String[] args) throws Exception {
> FileOutputStream fos = new
> FileOutputStream("/tmp/dir/that/doesnt/exist/test.txt");
> byte test[] = new byte[1024];
> fos.write(test);
> fos.close();
> }
>
> Since "/tmp/dir/that/doesnt/exist" doesn't existe, I get the exact same
> exception:
>
> java.io.FileNotFoundException:
> at java.io.FileOutputStream.open(Native Method)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:179)
> at java.io.FileOutputStream.<init>(FileOutputStream.java:70)
>
>
>
> And then, I've tried to make the directories that Tomcat needs to make
> the temporary .java, so I do:
>
> mkdir -p
> /home/horacio/tomcat-pruebas-startup/jakarta-tomcat-5.0.25/work/Catalina/localhost/prueba/org/apache/jsp
>
>
> and then, reloaded the page, and this work!!!!!
>
> So, the only problem is that Tomcat doesn't make the proper directory
> structure where it should put the generated .java...
>
> So:
> - If I run Tomcat from "startup.sh" -> WORKS
> - If I run Tomcat from "jsvc" on UNSTABLE -> WORKS
> - If I run Tomcat from "jsvc" on STABLE -> DOESN'T WORKS
>
> ON DEBIAN UNSTABLE:
> 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)
>
> ON DEBIAN STABLE:
> java version "1.4.2"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
> Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)
>
> ALSO ON DEBIAN STABLE:
> 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)
>
> Tomcat 5.0.25
>
> Is this a bug?
> How can I make work Tomcat on Debian stable with jsvc?
>
> Thanks in advance!
>
> Horacio de Oro
>
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: tomcat doesn't create directories under 'work' but does create .java/.class
files
Posted by Morus Walter <mo...@tanto.de>.
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org