Permission problems when trying to execute simple system command

Hi, I am quite new to JSP so please forgive me if I ask really simple things... I am trying to run system commands on the server and display the output on a webpage. This is what I've got:
<%@ page import="java.io.*" %>
<HTML>
<BODY>
<%
    Runtime rt = Runtime.getRuntime();
Process p = rt.exec("/bin/ls");
// for reading the output of the program
// (out of the program is in for us)
BufferedReader sOut = new BufferedReader(new
        InputStreamReader(p.getInputStream()));
// read the output
String line;
while ((line = sOut.readLine()) != null)
        out.println("line<BR/>");
%>
</BODY>
</HTML>However, when I run this, I get the following:
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Exception in JSP: /research/test.jsp:7
4: <%
5: Runtime rt = Runtime.getRuntime();
6:
7: Process p = rt.exec("/bin/ls");
8:
9: // for reading the output of the program
10: // (out of the program is in for us)
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
root cause
java.security.AccessControlException: access denied (java.io.FilePermission /bin/ls execute)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:323)
java.security.AccessController.checkPermission(AccessController.java:546)
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
java.lang.SecurityManager.checkExec(SecurityManager.java:779)
java.lang.ProcessBuilder.start(ProcessBuilder.java:447)
java.lang.Runtime.exec(Runtime.java:593)
java.lang.Runtime.exec(Runtime.java:431)
java.lang.Runtime.exec(Runtime.java:328)
org.apache.jsp.research.test_jsp._jspService(test_jsp.java:49)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
sun.reflect.GeneratedMethodAccessor63.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
Seems like it has something to do with the permissions granted to the JVM? I have googled high and low and still haven't found a way to solve it. I've also tried adding grant { permission java.io.FilePermission "file:/bin/ls", "execute"; } to my java.policy file but to no avail. Could somebody point out how to solve this? Thanks!

I would think it is an OS permission thing rather than java permission
What user is apache running as on this system?
Does the user apache is running as have permissions to run these commands, in the directory where you are running them? Try executing them yourself when logged in as that user.
I would also recommend you read the article [when runtime.exec() won't|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html].
Cheers,
evnafets

Similar Messages

  • Problems when trying to execute the jarfile

    I am facing a problem while executing a jar file.
    I have got a few .class files, when I run them in jbuilder , they run fine without any problems. Then I create a jar file using the jbuilder archive builder and try to run the jar file in dos prompt. It throws me an exception in one of my classes saying
    cannot instantiate class : com.evermind.server.rmi.RMIInitialContextFactory

    Hi,
    Could you please clarify on how you are trying to
    execute a jar file ? Do you mean that you do something
    like
         java <Classname> -cp <classpath>
    ? What do you do in your java program ? could you
    elaborate a little more ?
    Amlan.

  • Problemas when trying to execute a stored procedure

    hi.
    I'm trying to execute a stored procedure but i'm receiving this error:
    WSIF JCA Execute of operation 'myoperation' failed due to: Could not create/access the TopLink Session.
    This session is used to connect to the datastore. [Caused by: Connection Cache with this Cache Name is Disabled]
    ; nested exception is:
    ORABPEL-11622
    Could not create/access the TopLink Session.
    This session is used to connect to the datastore. [Caused by: Connection Cache with this Cache Name is Disabled]
    See root exception for the specific exception. You may need to configure the connection settings in the deployment descriptor (i.e. $J2EE_HOME/application-deployments/default/DbAdapter/oc4j-ra.xml) and restart the server. Caused by Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.4.0) (Build 080602)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: Connection Cache with this Cache Name is DisabledError Code: 17142.
    My bpel was working before and now i can't figure out what is going wrong.
    Thank you.

    'exec' is an sqlplus directive. If you run this query in PHP, try:
    $query = "BEGIN
    load_image('distribuido.JPG', '1');
    END;";
    (you may have to remove the ; after 'END')

  • Fatal error when trying to execute a dml-command with OLAP API

    Hi,
    when I created an OracleConnection using the jdbc thin driver. The connection works fine.
    But when I try to execute any dml-command with an SPLExecutor the following fatal error occurs:
    oracle.express.idl.util.OlapiException: ORA-37118: Message 37118 not found; product=RDBMS; facility=ORA
    ORA-06512: at "SYS.GENCONNECTIONINTERFACE", line 66
    ORA-06512: at line 1
    Any Suggestions ?

    Hi Priya,
    1.The entries for the initialization in the BW system are contained in the RSSDLINIT table for the DataSource/source system combination. Compare these with the entries in the ROOSPRMSC table in the OLTP system.
    2. If there are NO entries in the RSSDLINIT table in BW, use transaction RSA7 to delete the delta queue for this DataSource/BW application combination in the source system (OLTP).
    3.Once you deleted all the entries,In Infopackage scheduler option,delete all the init selections to proceed further.
    In which system u r going to do this.....Quality or production.(Better,you check with basis to delete the entries.)
    Regards
    Kumar

  • Permission Problem when trying to Installation Adobe Flash Player

    I'm having a problem installing the Adobe Flash Player in Windows 7 because I'm getting the now infamous message that there is not permission to install; however, mine is a bit different.
    I used to have Adobe Flash Player on my machine but it has disappeared, possibly inadvertently uninstalled.  Now, when I try to install the Flash Player, it appears to be almost done and then abruptly stops and gives the lack of permission message.  Note that I am NOT getting it installed and then it fails on a restart as most seems to do  ---  it won't install in the first place.
    Willing to try anything, I have downloaded and installed the subinacl.exe and the reset_fp.bat files in my Windows Resource Kits folder.  I try to run the reset_fp.bat file as Administrator (which I am) and the cursor changes to the hour glass and things are locked up.  I have to go to the Task Manager to end the process of Tools.
    Next, I can simply click on the reset_fp.bat file and it goes through the DOS looking screen with line of text running down like crazy but the bottom line after it stops says that the client does not have the proper permission.  Of course, that has not corrected my problem.  I do note that the first instruction in running that routine is "Install Adobe Flash Player" and that brings me back to my original problem  ---  I can't get Adobe Flash Player installed in the first place. .
    Anyone have any ideas  ---  I would be most appreciative.
    Jim B.

    Please try the offline installer:
    Internet Explorer:
    http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player_ax.exe
    Firefox and other NPAPI browsers:
    http://fpdownload.macromedia.com/pub/flashplayer/latest/help/install_flash_player.exe
    If that doesn't work, make sure that your filesystem is in good shape:
    Check your hard disk for errors in Windows 7
    Then reboot the machine and try again. 
    If that doesn't work, please post your installer logs:
    Where do I find the Flash Player installation log on Windows?

  • Problem when trying to execute OS Command in Notification Method

    Hi gurus,
    I am using EMGC 10.2.0.2 on windows XP, I have created a Notification method with a OS Command which is a batch file which intern calls a perl script to send a mail notification. When there is an alert the Alert History logs says that 1 OS Command is executed and show s the bat file name, but I am not getting any mail as expected. I have given the absolute path for bat file. What could be the reason for this and where can I find the logs for this knowing the status of OS command execution details.
    Thanks,
    Ashok Chava

    Hi bazza,
    My perl script is running fine in isolation no issues with that. I thought it may be becasue of the some time out issues then I have increased time from 30 second to 120 seconds by changing the property value "em.notification.os_cmd_timeout" in emoms.properties but with out any success. I dont have any logging messages put in the perl script I will check with that also. I have checked bat file by giving some logging messages the bat file eexcuting properly.
    Thanks,
    Ashok Chava.

  • Permission problem when trying to patch the kernel

    Hello, my name is Rodrigo and I have a VAIO laptop. The problem with it is that it has soo many privative components that are very hard to get to work under Linux. Fortunately, I found a project http://code.google.com/p/vaio-f11-linux/, which aims to provide full suport to VAIOs in Linux.
    In order to do this I had to patch the Kernel http://code.google.com/p/vaio-f11-linux … nelSupport
    So I started to follow the instructions.
    1) I downloaded from kernel.org the lastest stable release (2.6.39)
    2) I made cd /usr/src/linux and unpacked the tar contnents from the kernel file into this directory
    3) I made "sudo curl http://www.absence.it/vaio-acpi/source/ … 6.39.patch | patch p1" and I got this:
    patching file include/linux/sonypi.h
    patch: **** Can't rename file /tmp/poSN3DW6 to include/linux/sonypi.h : Permission denied
    I don't know if I'm the problem or if the patch is "bad".I already submitted the problem to the Issues page from the project, but maybe I made something wrong, any help would be apreciated
    Rodrigo

    I don't think sudo was meant for strange things like downloading a patch and then piping it into the patch command. If you want that to work, you should either run "su" to make sure you are root beforehand, or split up the commands like so:
    sudo curl http://www.absence.it/vaio-acpi/source/patches/vaio-2.6.39.patch >vaio-2.6.39.patch
    sudo patch p1 <vaio-2.6.39.patch
    The generic instructions for using this patch will probably work but it will be cleaner if you look at the wiki page for Arch's take on custom kernels.
    Last edited by ConnorBehan (2011-05-25 03:15:06)

  • Permission problems when trying to play dvd's

    I'm using devfs and I made a symlink from /dev/cdroms/cdrom0 to /dev/dvd in the configfile. But when I pop in a dvd and hit play in xine, vlc, mplayer etc., I don't have permission to read it. It works if I "chmod a+r /dev/dvd", but this is only temporary and changes again if I reboot. I wondered if anyone could tell me how to make reading rights to /dev/dvd permanent as regular user?

    rottenikken
    I don't have permission to read it.
    first of all, login from a terminal as su -
    less /etc/fstab         and check the location of your dvd player.
    ie   /dev/cdroms/cdrom0     /mnt/dvd  udf   rw,user,noauto,unhide   0  0
    q quit    and then run xine , from the same root terminal.
    if you still get the "no permissions" fault , then its likely xine is pointing at
    the wrong place and is actually fouling itself.
    open up the setup panel (spanner) and under GUI tab set experience level to
    "Master of known universe".
    close and restart xine. go back to that panel to check its still set as Master.
    Now go to the [media] tab. Scroll down to the [device used for dvd playback]
    set this to /mnt/dvd  ( dont forget to check you actually have a directory called /mnt/dvd and if not, then make one).
    below this  in the [raw device  ...] set it as  /dev/cdroms/cdrom0  assuming thats whats in fstab file.
    Click the [Apply] and [Close] and close Xine.
    from the root (su - ) terminal
    mount /dev/cdroms/cdrom0 /mnt/dvd
    start xine again. Click the dvd button.
    If this works, then repeat that setup process  from a normal user terminal, or from the start menu u use to open programs.
    to use again u just have to mount the drive, from a root terminal, then use xine as a normal user.
    i choose to mount dvd and cds manually from a root terminal, but if all this has worked, and you want to automount, thats a different
    prob
    hth
    Kern

  • Problem when trying to print standart invoice crystal report for SAP

    Hi All, I have the following problem when trying to print a system invoice report in crystal reports for SAP
    I pass params and load the report using this code
    Private Sub DisplayThreadReportSeq()
    Dim oView As New frmViewReport
    Dim strReportPath As String = ""
    Dim strParamName As String = ""
    Try
    Dim CR As New ReportDocument
    CR.Load(oReport.CrstPath)
    ' Declare the parameter related objects.
    SetReportValues(CR)
    Dim crParameterDiscreteValue As ParameterDiscreteValue
    Dim crParameterFieldDefinitions As ParameterFieldDefinitions
    Dim crParameterFieldLocation As ParameterFieldDefinition
    Dim crParameterValues As ParameterValues
    ' Get the report's parameters collection.
    For Each oPar As cslParam In oReport.Params
    crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
    crParameterFieldLocation = crParameterFieldDefinitions.Item(oPar.ParName)
    crParameterValues = crParameterFieldLocation.CurrentValues
    crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
    crParameterDiscreteValue.Value = oPar.Value
    crParameterValues.Add(crParameterDiscreteValue)
    crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
    Next
    If pPrint Then
    If oReport.Printer "" Then
    CR.PrintOptions.PrinterName = oReport.Printer
    End If
    CR.PrintToPrinter(IIf(oReport.Copies = "", 1, oReport.Copies), False, 0, 0)
    SBO_Application.StatusBar.SetText("Printed Document Successfully", SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Success)
    Else
    oView.Text = pReport
    oView.TopMost = True
    oView.Viewer.ReportSource = CR
    oView.Hide()
    oView.ShowDialog()
    End If
    Catch ex As Exception
    Util_GenErrorLog("DisplayReport", ex)
    End Try
    End Sub
    This code works fine when the report invoke to print is developed in crystal reports version for .net 2008 or .net 2005
    when trying to print a report standart getting from SAP BO 8.8.1 using this code I getting the following error:
    Error in File C:UsersecombaAppDataLocalTemp5ARInvoiceStandartSap {300B9A68-DF05-4D7B-8F3B-1670A4493BEE}.rpt:
    Error in formula .
    'Shared numberVar SectionTotalMaxHeght;
    A number, currency amount, boolean, date, time, date-time, or string is expected here.
    This report is the standart report that SAP 8.8.1 includes and works fine on SAP.
    I referenced this dlls CrystalDecisions.CrystalReports.Engine.dll, CrystalDecisions.CrystalReports.Shared, version 10.2.3600
    How I can get these dll´s version for Crystal Report 2008 for SAP Business one or How I can solve this problem
    thanks in advance,
    Ezequiel.

    Hi Ezequiel,
    You can try to search in SAP Business One Reporting & Printing forum section or post there.
    nd.Q

  • I get this message when trying to past simple text into an e-mail document. The Web-Based Email plugin has crashed. I have run out of options...please help.

    The Web-Based Email plugin has crashed. I get this message when trying to paste simple text into an email document. I have updated plugins and have run out of options. If I use another browser I have no problem. Please advise.

    UPDATE
    Compiling from command line I found out that the class definition for oracle.oats.scripting.modules.basic.api.IteratingVUserScript is missing. Do you know what .jar file contains this class?
    Thanks.
    Fede.

  • Hi There, I have a problem when trying to print either Email or from a web page.

    Hi There,
    I have a problem when trying to print contents fro either Email's or from web pages, the problem started after i opened Google earth and it down loaded Google Chrome i do not like Google chrome so i removed it from my pc via add and remove programmes since then when i try to print an email i get what looks like the computer settings for writing the email and not the text same for web pages, as anyone come across this problem before i can print any word or spreadsheet documents but problem is with email's and web pages.
    Many Thanks.

    Something changed on your system, possibly when Google Chrome installed. It could  be many things, but what it boils down to, is it needs to go back to the way it was. Either by removing whatever else might still be left from the install, or maybe by reinstalling the printer itself.
    007OHMSS
    I was a support engineer for HP.
    If the advice resolved the situation, please mark it as a solution. Thank you.

  • Getting error -2147221219 when trying to execute OpenMsgStore function on Exchange 2007 Server

    Hello,
      I am getting error -2147221219 when trying to execute OpenMsgStore API on Exchange Server 2007. I have created the Public Folder also on the same server. Also, I have installed the Microsoft Exchange Server MAPI Client and Collaboration Data Objects 1.2.1 on the server. Please do let me know if our previous MAPI / CDO applications would work for Exchange Server 2007 in this environment?
      Also, while executing the Microsoft Exchange MAPI editor when I click on Session -> Logon and Display Store Table I see Err:0x8004010F=MAPI_E_NOT_FOUND in the row type column. The MAPI initialization is successful and in the Display Name I get Public Folders and Mailbox - Administrator. Please let me know how to I make work the MAPI Editor.
      Thanks for your time and cooperation !!
    Thanks & Regards,
    Neel

    Answers in social.msdn.microsoft.com/Forums/en-US/3a2e9489-6137-42fb-95d1-bebcfe2ea138 may solve your problem.
    PR_PROFILE_CONNECT_FLAGS = 0 will also work.

  • Problem when trying to place a post wrt BSP

    Colleagues,
    for a few days i am encountering problems when trying to place a post regarding BSP issue. I am not sure if this is just an IE settings problem or sth on the SDN forum side.
    Another option is to check for customized corporate settings of the current project owner.
    Any cool ideas are warmly welcomed.
    Cheers, Harry
    OK, this has been working fine. So what is the problem on the BSP forum? SAP buddies, please assist!
    Many THX in advance!
    Edited by: Harald Schwenger on May 8, 2008 10:50 AM
    Edited by: Harald Schwenger on May 8, 2008 10:52 AM

    Your launch services database, which stores information about which applications should open certain documents, may need to be repaired. Open the Terminal application found in /Applications/Utilities and paste in this command (all one line):
    System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/La unchServices.framework/Versions/Current/Support/lsregister -kill -r -domain system -domain local -domain user
    Hit the return key, log out and log in.
    Hope this helps! bill
    1 GHz Powerbook G4   Mac OS X (10.4.7)  

  • I got problem when trying to contact my iphone 4 using facetime,it did ringing,but my iphone 4 did not receive that call as if nothing happen.But,when the call ended,that call appeared in the missed call list.fyi both are connected to internet.

    i got problem when trying to call my iphone 4 using facetime with my Macbook Pro 13',it did ringing,but my iphone 4 did not receive that call as if nothing happen.But,when the call ended,that call appeared in the missed call list.fyi both are connected to internet.Help!! thank you in advance

    i got problem when trying to call my iphone 4 using facetime with my Macbook Pro 13',it did ringing,but my iphone 4 did not receive that call as if nothing happen.But,when the call ended,that call appeared in the missed call list.fyi both are connected to internet.Help!! thank you in advance

  • I am having the problem when trying to take a panorama picture.   It may only take the first frame or doesn't even start at all when I press the shutter button. even though when i  hold the phone straight up and down, so that camera is at the top

    I am having the problem when trying to take a panorama picture. 
    It may only take the first frame or doesn't even start at all when I press the shutter button.
    even though when i  hold the phone straight up and down, so that camera is at the top on the back and the home button is on the bottom on the front.
    This problem is irritating me....?

    To take panorama
    - ensure that the panorama option is on
    - press the shutter button once
    - you will see a line with an arrow
    - move around in a circle  ( I keep the camera steady and turn myself around in a circle)
    - as you do this you will see the arrow moving across the screen as it captures pictures
    - at the end of the capture, you will be able to see your panorama picture
    I hope that this helps, do report back.

Maybe you are looking for