You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christian Riedel <sa...@nurfuerspam.de> on 2004/08/26 10:08:36 UTC

Is struts interfering with Runtime.exec() calls?

Hi all,

some days ago I posted a problem about not being able to do a chmod on 
the local file system from withing my webapp via a Runtime.exec() call. 
To achieve this I tried the following call:

> "/bin/chmod 660 /home/sarek/test/testfile"

wich did not show any effect. Nor do most of the other calls I tried 
which only had other permissions to be set.

Here is a list of my attempts and their results:

new perm	before		after
------------------------------------------
g+rw		-rw-------	-rw-------
u=rw,g=rw	-rw-------	-rw-------
0660		-rw-------	-rw-------
0770		-rw-------	-rw-------
770		-rw-------	-rw-------
777		-rw-------	-rw-------
664		-rw-------	-rw-------

but most suprisingly:

064		-rw-------	----rw-r--

Now the problem is that I need to set the file's permission to 
-rw-rw---- which I have not managed to do so far :-(

I thought there was a problem with tomcat and and security issues that 
prevents me from doing such things. So I just tried a small test-jsp to 
see if this was really the case:

> <html>
>         <head>
>                 <title>Page to test java.lang.Runtime calls for chmod</title>
>         <head>
>         <body>
> <%
> try {
>         String chmod = "/bin/chmod 660 /home/sarek/test/testfile";
>         Runtime run = Runtime.getRuntime();
>         out.println("- got Runtime<br>");
>         Process p = run.exec(chmod);
>         out.println("- executed: "+chmod+"<br>");
>         p.waitFor();
>         out.println("- Process ended with exit code "+p.exitValue()+"<br>");
> }
> catch (Exception e){
>         out.println("<br><font color='red'><strong>- caught exception: "+e.getMessage()+"</strong></font><br>");
> }
> %>
>         </body>
> </html>

With the result that any permissions I tried to set with this page are 
set just as I want them to. So it does not seem that tomcat is the problem.

Now my actual question:

Can it be that struts - because I actually want to call the chmod 
command from within a struts based application - is interfering with my 
attempts to do this Runtime call?

I have no idea why all other attempts work but not when doing it from 
within the application itself. We don't have any security manager set 
and the testfile I pasted before works fine on the same tomcat instance.

Can anyone help me?

TIA

Christian
-- 
To reply to this posting directly use the following address and
remove the 'NO-SPAM' part: Riedel.Christian.NO-SPAM@gmx.net


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


RE: Not serving JSPs

Posted by Daron <tb...@bigpond.net.au>.
thanx

-----Original Message-----
From: Nikita [mailto:nikita@workoutiq.com] 
Sent: Thursday, 26 August 2004 6:19 PM
To: Tomcat Users List
Subject: Re: Not serving JSPs


Daron wrote:

>Thanks for responding Nikita, yes I am using XP.
>
>My JAVA_HOME is set correctly. This has brought up an issue though. 
>JAVA_HOME is set to: C:\Program Files\Java\j2sdk1.5.0
>  
>
likely. try:  '%JAVA_HOME%/bin/javac'  from console. if that fails to 
find javac, then enclose the above path in quotes when setting JAVA_HOME:
"C:\Program Files\Java\j2sdk1.5.0"

as an aside, jdk 1.5 is still a beta, you may want to use jdk 1.4 if 
you're still having problems (other than you're currently experiencing)


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
 



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


Re: Not serving JSPs

Posted by Nikita <ni...@workoutiq.com>.
Daron wrote:

>Thanks for responding Nikita, yes I am using XP.
>
>My JAVA_HOME is set correctly. This has brought up an issue though.
>JAVA_HOME is set to:
>C:\Program Files\Java\j2sdk1.5.0
>  
>
likely. try:  '%JAVA_HOME%/bin/javac'  from console. if that fails to 
find javac, then enclose the above path in quotes when setting JAVA_HOME:
"C:\Program Files\Java\j2sdk1.5.0"

as an aside, jdk 1.5 is still a beta, you may want to use jdk 1.4 if 
you're still having problems (other than you're currently experiencing)

cheers
-nikita

>Will the space cause problem ?
>
>Daron.
>
>-----Original Message-----
>From: Nikita [mailto:nikita@workoutiq.com] 
>Sent: Thursday, 26 August 2004 5:57 PM
>To: Tomcat Users List
>Subject: Re: Not serving JSPs
>
>
>Daron wrote:
>
>  
>
>>Hi,
>>
>>I set up Tomcat a few months ago and have just been able to start 
>>looking at it again. It is serving up my html documents but with jsps 
>>it complains. The error page includes:
>>
>>Unable to find a javac compiler;
>>com.sun.tools.javac.Main is not on the classpath.
>>Perhaps JAVA_HOME does not point to the JDK
>> 
>>
>>    
>>
>first step is to check JAVA_HOME. open a console and type 'echo 
>%JAVA_HOME%'. see if proper directory shows up. if not, check your 
>environment settings in 'system' in control panel. i am assuming you're 
>running win xp or similar
>
>-nikita
>
>  
>
>>	
>>org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompi
>>ler(C
>>ompilerAdapterFactory.java:106)
>>
>>I have set the environment variable JAVA_HOME to point to a JDK and 
>>checked that it contains a bin directory with a javac.exe file but I 
>>still get the problem. Can anyone direct me to other issues that I 
>>should look at.
>>
>>Regards,
>>Daron Ryan.
>>
>>---
>>Outgoing mail is certified Virus Free.
>>Checked by AVG anti-virus system (http://www.grisoft.com).
>>Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>> 
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
> 
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
> 
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>  
>


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


RE: Not serving JSPs

Posted by Daron <tb...@bigpond.net.au>.
Thanks for responding Nikita, yes I am using XP.

My JAVA_HOME is set correctly. This has brought up an issue though.
JAVA_HOME is set to:
C:\Program Files\Java\j2sdk1.5.0

Will the space cause problem ?

Daron.

-----Original Message-----
From: Nikita [mailto:nikita@workoutiq.com] 
Sent: Thursday, 26 August 2004 5:57 PM
To: Tomcat Users List
Subject: Re: Not serving JSPs


Daron wrote:

>Hi,
>
>I set up Tomcat a few months ago and have just been able to start 
>looking at it again. It is serving up my html documents but with jsps 
>it complains. The error page includes:
>
>Unable to find a javac compiler;
>com.sun.tools.javac.Main is not on the classpath.
>Perhaps JAVA_HOME does not point to the JDK
>  
>
first step is to check JAVA_HOME. open a console and type 'echo 
%JAVA_HOME%'. see if proper directory shows up. if not, check your 
environment settings in 'system' in control panel. i am assuming you're 
running win xp or similar

-nikita

>	
>org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompi
>ler(C
>ompilerAdapterFactory.java:106)
>
>I have set the environment variable JAVA_HOME to point to a JDK and 
>checked that it contains a bin directory with a javac.exe file but I 
>still get the problem. Can anyone direct me to other issues that I 
>should look at.
>
>Regards,
>Daron Ryan.
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
> 
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>  
>


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
 



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


Re: Not serving JSPs

Posted by Nikita <ni...@workoutiq.com>.
Daron wrote:

>Hi,
>
>I set up Tomcat a few months ago and have just been able to start looking at
>it again. It is serving up my html documents but with jsps it complains. The
>error page includes:
>
>Unable to find a javac compiler;
>com.sun.tools.javac.Main is not on the classpath.
>Perhaps JAVA_HOME does not point to the JDK
>  
>
first step is to check JAVA_HOME. open a console and type 'echo 
%JAVA_HOME%'. see if proper directory shows up. if not, check your 
environment settings in 'system' in control panel. i am assuming you're 
running win xp or similar

-nikita

>	
>org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(C
>ompilerAdapterFactory.java:106)
>
>I have set the environment variable JAVA_HOME to point to a JDK and checked
>that it contains a bin directory with a javac.exe file but I still get the
>problem. Can anyone direct me to other issues that I should look at.
>
>Regards,
>Daron Ryan.
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
> 
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>  
>


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


Not serving JSPs

Posted by Daron <tb...@bigpond.net.au>.
Hi,

I set up Tomcat a few months ago and have just been able to start looking at
it again. It is serving up my html documents but with jsps it complains. The
error page includes:

Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
	
org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(C
ompilerAdapterFactory.java:106)

I have set the environment variable JAVA_HOME to point to a JDK and checked
that it contains a bin directory with a javac.exe file but I still get the
problem. Can anyone direct me to other issues that I should look at.

Regards,
Daron Ryan.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.740 / Virus Database: 494 - Release Date: 16/08/2004
 



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