Re: File.mkdirs() don't work if started with jsvc
Shapira, Yoav wrote: Hi, Could it be your umask? Yoav Shapira Millennium Research Informatics I don't think so... I've the standard 0022 umask... With the same umask (0022) jsvc works well with Debian Sarge/Sid, but doesn't work with Debian Woody (stable). Horacio -Original Message- From: Morus Walter [mailto:[EMAIL PROTECTED] Sent: Monday, July 19, 2004 5:18 AM To: Tomcat Users List Subject: Re: File.mkdirs() don't work if started with jsvc 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File.mkdirs() don't work if started with jsvc
Ralph Einfeldt wrote: Was /tmp/test created ? If yes, which rights are set in this directory ? With: fileName = "/tmp/test/something"; the /tmp/test/something dir is NOT created, the /tmp/test dir is NOT created. Horacio -Original Message- From: Horacio de Oro [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 8:21 PM To: Tomcat Users List Subject: Re: File.mkdirs() don't work if 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File.mkdirs() don't work if started with jsvc
Hi, Could it be your umask? Yoav Shapira Millennium Research Informatics >-Original Message- >From: Morus Walter [mailto:[EMAIL PROTECTED] >Sent: Monday, July 19, 2004 5:18 AM >To: Tomcat Users List >Subject: Re: File.mkdirs() don't work if started with jsvc > >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: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File.mkdirs() don't work if started with jsvc
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: File.mkdirs() don't work if started with jsvc
Was /tmp/test created ? If yes, which rights are set in this directory ? > -Original Message- > From: Horacio de Oro [mailto:[EMAIL PROTECTED] > Sent: Friday, July 16, 2004 8:21 PM > To: Tomcat Users List > Subject: Re: File.mkdirs() don't work if 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File.mkdirs() don't work if started with jsvc
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File.mkdirs() don't work if started with jsvc
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File.mkdirs() don't work if started with jsvc
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(""); out.println(""); out.println("Servlet"); out.println(""); try { String fileName = "/tmp/test/" + System.currentTimeMillis() + "/test/afile.txt"; out.println("File name: " + fileName + ""); File file = new File(fileName); boolean ok = file.mkdirs(); if(ok) out.println("OK"); else out.println("FAIL without exception!"); } catch(Exception e) { out.println("FAIL with exception!"); out.println(""); StackTraceElement el[] = e.getStackTrace(); out.println(e.getMessage()); for(int i=0; i"); } out.println(""); out.println(""); out.println(""); out.close(); } If I start Tomcat with "startup.sh", I get: File name: /tmp/test/108282783/test/afile.txt OK If I start Tomcat with "jsvc", I get: File name: /tmp/test/108639863/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.(FileOutputStream.java:179) at java.io.FileOutputStream.(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.(FileOutputStream.java:179) at java.io.FileOutputStream.(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 m