Running scripts from Java user permissions

I have a web based application running on JBoss application server. It during its processing of certain requests has to call some cshell scripts using Runtime.exec(). Now it seems to be working fine in development environment, however on testing environment it seems to freeze. On further debugging, and digging up the issue it came up that it could be a permissions issue, as certain users have the permissions to run the scripts and some don't.
The Question therefore would be that, once a script is executed from an app server, which user is used? and in order for the script to be executed who should be granted permissions.
Thanks in advance.

Peter__Lawrey wrote:
When any application starts another application (java or otherwise) it does so as the same user by default.
The user running the JBoss is the user used.
This is how all OSes work (to my knowledge)
Which operating system are you using?Thanks, in that case I have a second question. Is there a way to force a certain user? I mean somebody other than the one who started the app server programmatically?

Similar Messages

  • Run a UNIX Script from java

    Hi,
    how can i run a unix script from java application. This java application is on windows.
    How can i do this.
    thanks,

    Hi,
    how can i run a unix script from java application.
    This java application is on windows.
    So I think it's safe to assume that the target script is on a remote unix server.
    Take a look at http://sourceforge.net/projects/sshtools/

  • Running sqlplus scripts from Java code?

    hi
    I need to programmatically run sqlplus scripts from Java code on a machine that doesn't have sqlplus installed.
    Is there any Java class library available for doing this?

    The Ant approach could probably work for me, thanks for the tip.
    The setup seems rather complex however, given the simplicity of the task. I would prefer just running a Java based SQL*Plus from in a separate process or doing this via an API that would allow me to run SQL*Plus scripts (parse script, substitute variables, run statements).
    Oracle SQL Developer v1.1 appears to include an API that does exactly this.
    The ScriptParser, Substitution and SQLPLUS classes in the oracle.dbtools.raptor.scriptrunner package (oracle.sqldeveloper.jar) seem to do just what I need based on my tests.
    Can I use these classes for this purpose in my application? Is repackaging allowed?
    Does Oracle have any plans for releasing this sort of functionality separately e.g. as part of the Instant Client?

  • Script Alert "You should only run scripts from a trusted source."

    I created a small javascript which opens Photoshop and resizes some images.
    I want to be able to double-click the .JSX file from Windows Explorer, and have Photoshop execute the script. Likewise, I want to be able to run the .JSX file from the command line.
    The script runs perfectly. However, the problem is that I don't want any user interaction. I want to be able to run the script from the command line without the user having to click anything. What happens now when I try to run the file from Windows Explorer of the command line is, I get a Script Alert with the following text:
    You are about to run a script in Adobe Photoshop CS3. You should only run scripts from a trusted source. Do you want to run the script? Yes/No
    Is there any possible way to bypass this message or to answer in the affirmative?
    Thanks,
    Jamie L.

    Hi... Sorry to revive such an old thread,
        Does anyone know the "trusted source" folder for MAC CS4.
    EDIT!
    My bad.  "The /users/<user_name>/documents/Adobe Scripts" folder is working for this purpose for me.  I needed a path to it and forgot that the ~ resolves to the current user.  Sweet.
    -Bill

  • Problems downloading and installing OS X Yosemite An error occurred while running scripts from the package

    Hi! I have problems downloading and installing OS X Yosemite.
    While downloading this message pops up:
    An error occurred while running scripts from the package \U201cwct8079783343594854923.pkg\U201d.
    and in /var/log/install.log i can see:
    MacBook-Pro installd[1086]: PackageKit: Install Failed: PKG: pre-install scripts for "com.apple.pkg.InstallMacOSX"\nError Domain=PKInstallErrorDomain Code=112 UserInfo=0x100193c00 "An error occurred while running scripts from the package “wct8079783343594854923.pkg”." {\n    NSFilePath = preinstall;\n    NSLocalizedDescription = "An error occurred while running scripts from the package \U201cwct8079783343594854923.pkg\U201d.";\n    NSURL = "#InstallMacOSX.pkg -- file://localhost/Users/username/Library/Application%20Support/AppStore/91504108 2/wct8079783343594854923.pkg#Distribution";\n    PKInstallPackageIdentifier = "com.apple.pkg.InstallMacOSX";\n}
    does anyone have an idea about this?
    thank you very much

    Mucked up installation. If the installer app is still in /Applications, delete it and start over.
    27" i7 iMac (Mid 2011) refurb, OS X Yo (10.10.2), Mavs, ML & SL, G4 450 MP w/10.5 & 9.2.2

  • Example: Executing a shell script from java

    Hi. There are many other posts in the forums related to executing a unix script from java, but I wanted to post another example that I thought might be helpful...
    The key thing to executing the script is to include the -c switch for the sh command. This tells the sh command that you are passing a string to be interpreted as input. Without this switch, the script does not execute as you'd expect it to. Also, use a string array to pass each part of the sh command.
    Here is a working sample class, along with a test script to execute it:
    public class TestShellScript {
    public static void main(String[] args)
    String[] chmod = {"chmod","777","testscript1"};
    String[] runscript = {"sh","-c","./testscript1 > jdata.out"};
    Runtime rtime = Runtime.getRuntime();
    try
    rtime.exec(chmod); // Set the authorities for testing
    rtime.exec(runscript); // Run the script with redirection
    catch (IOException e)
    e.printStackTrace();
    rtime = null;
    Here is a test script to wrap the java call:
    #!/bin/sh
    cd /<your script dir>
    export -s CLASSPATH=/<your jar dir>/TestShellScript.jar
    export -s PATH=/<your script dir>:/usr/bin
    java TestShellScript
    - Hope this helps.

    I don't know exactly but the code written below is working fine try the same with your code .Even with your code instead running the code with
    " ./<filename> ",if you execute it with "sh <filename>" command without changing the mode of the file it is executing properly.
    import java.io.*;
    import java.util.*;
    public class ScriptBuilder
    public ScriptBuilder()
    public void writeScript() throws java.io.IOException
    FileWriter writer = new FileWriter(new File("test_script"));
    writer.write("#! /bin/sh\n");
    writer.write("ll>/home/faiyaz/javaprac/checkll");
    writer.flush();
    writer.close();
    Runtime rt= Runtime.getRuntime();
    rt.exec("chmod 777 test_script");
    rt.exec("./test_script");
    } public static void main (String[] args)throws java.io.IOException
    ScriptBuilder sb = new ScriptBuilder();
    sb.writeScript();
    }

  • Invoking a bash shell script from Java code

    Hi All
    I am trying to invoke a Bash shell script using java code. The arguments required are "source wmGenPatch <source dir> <destination dir> no_reverse.
    in the code I have specified the arguments considering the cannonical paths of the files as the code may run on Unix or windows platform.
    I am getting a error while invoking Runtime.getRuntime().exec(args). The error is as follows :
    "The Error Occurred is: CreateProcess: source D:\Package4.0\workspace\DiffEngineScripts\v4a02\wmGenPatch D:\Package4.0\workspace\fromImageFilesDir\ D:\Package4.0\workspace\toImageFilesDir\ no_reverse error=2"
    It seems that error=2 indicates that the 'file not found' exception. But i can see the directories referred to in the error at place in the workspace.
    Kindly advice.
    Thanks in advance.

    Hi All
    I am pretty new to invoking bash shell scripts from java and not sure if i am progressing in right direction.
    The piece of code tried by me is as follows
    try {
                   currentDir = f.getCanonicalPath();
              } catch (IOException e) {
              if (currentDir.contains("/")) {
                   separator = "/";
              } else {
                   separator = "\\";
              String args[] = new String[7];
              args[0] = "/bin/sh";
              args[1] = "-c";
              args[2] = "source";
              args[3] = currentDir + separator + "DiffEngineScripts" + separator
                        + "v4a02" + separator + "wmGenPatch";
              args[4] = sourceFileAdd;
              args[5] = destFileAdd;
              if (isReverseDeltaRequired) {
                   args[6] = "reverse";
              } else {
                   args[6] = "no_reverse";
              try {
                   Process xyz = Runtime.getRuntime().exec(args);                              
                   InputStream result = xyz.getInputStream();
                   InputStreamReader isr = new InputStreamReader(result);
                   BufferedReader br = new BufferedReader(isr);
                   String line = null;
                   while ( (line = br.readLine()) != null)
                        System.out.println(line);
                   int exitVal = xyz.waitFor();
                   System.out.println("Leaving Testrun.java");
              } catch (Throwable t) {
                   t.printStackTrace();               
    and on running the same i am getting Java.io.IOException with the stack trace
    java.io.IOException: CreateProcess: \bin\sh -c source D:\Package4.0\workspace\DiffEngineScripts\v4a02\wmGenPatch D:\Package4.0\workspace\fromImageFilesDir\ D:\Package4.0\workspace\toImageFilesDir\ no_reverse error=3
    kindly advice
    Thanks in advance

  • Call PERL script from JAVA

    I am facing a problem in running a PERL script in JAVA in UNIX box..
    I am able to call ther perlscript.
    Perl script has
    #! /usr/local/bin/perl
    print "\nEnter Your Name :";
    $name = <>;
    print "\nYour Name is : $name\n";
    exit 0;
    Perl script request for the INPUT(name) .
    My Java program is
    File perlfile = new File("test.pl");
    Runtime runtime = Runtime.getRuntime();
    Process process = runtime.exec("perl "+perlfile);
    Here is the problem tat IT IS says error =2 ..What has to be the solution so tat i can CALL PERL SCRIPT as similiar to running it separatly in prompt { >perl test.pl }
    PLEASE help me on this....

    In the PERL SCRIPT (test.pl)
    LINE 1 : #! /usr/local/bin/perl
    LINE 2 : print "\nEnter Your Name :"; .
    LINE 3 : $name = <>;
    LINE 4 : print "\nYour Name is : $name\n";
    LINE 5 : exit 0;
    When i run this script in perl test.pl in prompt (UNIX BOX), i am gettin the request for name "Enter Your Name:____ " but when i call this script from Java it doesn't request for name and moreover the process doesnt ends (use ctrl+c to come out of the process).When i come out forcefully it shows the ERROR=2.
    My requirement is such tat need to call a PERL SCRIPT from java so tat java process give the control to PERL script and it will continue the process..
    Sample scenario:
    Java move a file and store it in a new FOLDER
    MY perl script will read the file in new FOLDER.
    here the perl script will get the file name for processing... My issue comes here .$name is not be prompted while calling thro java..

  • HT1222 hi i have a apple imac 27 2009 and i have purchased mountain lion but near the end it says An error occurred while running scripts from the package "mzps6175750011235388779.pkg"

    hi i have a apple imac 27 2009 and i have purchased mountain lion but near the end it says An error occurred while running scripts from the package “mzps6175750011235388779.pkg”
    can you please advise me what should i do to fix this

    Some ideas.
    https://discussions.apple.com/message/20034600#20034600

  • Cannot prevent ExtendScript debugging while running scripts from After Effects

    Hi,
    I am facing this issue while running scripts from within After Effects. Whenever I am trying to run a script in After Effects, the script opens up in ESTK in the debug mode. The execution waits at the starting point of the script as if there is breakpoint even though there is none. I am not sure whether what I am missing, whether some debug flag needs to be reset etc. I am using After Effects CC on Windows 7 OS. Any help would be highly appreciated.
    Thanks.

    I tried running the script after removing all $.writeln() statements, but unfortunately that does not resolve the problem. For testing the issue, I am trying with the simple script given below :
    var window = new Window ("palette", "My Window", undefined);
    var panel = window.add("panel", undefined, "Panel");
    var text = panel.add("statictext", undefined, "Testing AE");
    window.show();
    But executing even this one from AE opens up ESTK. I am absolutely stuck with this odd behaviour .

  • An error occurred while running scripts from the package "ztb343812063996219254.pkg

    i tried to upgrade my os lion 10.7.5 to os x yosemite on my macbook pro and in the middele of downloading I'm getting this notice: an error occurred while running scripts from the package "ztb343812063996219254.pkg
    help me please…..
    i think i have problem with the app store cause sometimes I'm getting more errors like error no 13 or 100
    what should i do?

  • Error when running script from OTM

    Hi team,
    Customer is trying to run script from OTM but is getting a "JWG file does not exist" error. I found the following metalink note and the customer has verified that the repositories are defined with exactly the same names & paths in OTM & Openscript.
    Scripts Failing To Play Back From OATS Test Manager (OTM) (Doc ID 1587941.1)
    I've also checked the following post in the forums but this doesn't apply to the customer because both the OTM & agent are on Windows:
    https://forums.oracle.com/message/10707963
    Appreciate any pointers
    Thanks,
    Krishna

    Hi Krishna
    Is the agent running as a windows service or started from an interactive batch?
    What kind of script is that? Web, Forms, Siebel, other?
    Are they different repositories or the same? If different, how do you copy scripts from one to the other one?
    Cheers
    JB

  • How to execute unix shell script from Java ...

    Hi,
    Anyone know how to execute unix shell script from Java?
    Suppose I have several shell scripts written in perl or tcl or bash.
    I just want to catch the output of that script.
    Is there any ready to use module/object for this?
    Please let me know, this is quite urgent for my study assigment.
    Thanks in advance,
    Regards,
    me

    Look up Runtime.exec()

  • Excute unix script from java.

    Hi need to excute unix script from java application.
    My code is:
    public class Test
    public static void main(String args[])
         try{
         p = Runtime.getRuntime().exec("./qfe0"); //qfe0 is the name of the script.
    p.waitFor();
    catch(Exception e)
    e.printStackTrace();
    My problem is that using the waitFor() statement stuck the the script. if i don't use the waitFor() it works good but then i don't know when the script is finished.
    Any idea?

    The problem is likely to be that you script is either waiting for input or has filled the stdout buffer and you are not emptying it. Search this forum for this as its been answered many times before.

  • How execute Unix script from java?

    Can I execute Unix script from java?

    Yes. Using ProcessBuilder. And read [When Runtime.exec() wont|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html]. It's old, but pretty much all of it is still true.

Maybe you are looking for

  • Changing the source system in QA

    Hello All, I just wanted a quick opinion from your experience on the following issue: We  have a ECC Dev client 20 connected to BI Dev client 20 Similarly we have ECC QA 120 connected to BI QA 120 But due to some reason we now want to connect a new E

  • Cannot load Java plug-in and access R12 Oracle form from client

    Hi, one of my user cannot open Oracle form when accessing R12 environment using IE6. After selecting responsibility and menu, it got stuck after 50% processing when trying to load Java applet. It never got completed even after waiting for 2-3 hours.

  • UNABLE TO OPEN PDF ATTACHMENTS IN E-MAIL

    Over the past week,I have been unable to open PDF attachments in my AOL webmail.  I encounter no problems with my Outlook Express e-mail.  Why is this suddenly happening and how can I correct the problem?

  • Very Basic Mail Issue

    I have been hosting my website on a g4 xserve with 10.3 server successfully for a year and a half or so. I am not running any mail server on the machine. All email for the domain is hosted by an email hosting company. Recently I noticed scripts that

  • Missing line breaks with Excel

    Hello,   Am downloading certain into Excel using BSP. I am changing response mime type to "application/vnd.ms-excel" and am sending tab-demilited string as data.   Some of the columns should contain line break within the cell( Mean the Alt-Enter in E