Runtime.exec()  in Java not working in Oracle 10 Application Server

Hi ,
I am trying to call a .exe file which is in the Web Application folder .
I am Using Process p = Runtime.exec("path to .exe file ")
This code is working fine when used with JBOSS , but not working with Oracle Application server .
Please tell me whether i need to do any chnages to make it work
Thanks in advance .

I ran a quick test with your code, I just had to make some small changes, and things work for me...
I'm testing with JDeveloper 10g 10.1.3.2.0 ...
The only thing I wonder is DBUser DBPass DBHost, those are not the actual values, correct?, neither they are environment variables?...
In the server hosting your OAS, you should try running the whole CMD line from the start/run dialog ... make sure it works in that server ...
Here is the code used in my test:
In JSP:
  <%@ page import="runexepkg.*" %>
  <% 
  String msg = "";
  try
  RunEXE p = new RunEXE();
  msg = p.main1();
  catch(Throwable t)
     System.out.println("Exception Raised");
     t.printStackTrace();
  %>
  <%= msg %>In Java Class:
package runexepkg;
import java.sql.*;
public class RunEXE
    String ss="";
    public String main1()
    try
        Runtime rt=Runtime.getRuntime();
        Process p = rt.exec("CMD /C start C:\\oraappserver\\j2ee\\WebGis\\applications\\PowerGis\\web\\WEB-INF\\classes\\GisProject\\cust_data_1.exe DBUser DBPass DBHost");
        System.out.println("Command has been executed");
        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection con = DriverManager.getConnection("jdbc:oracle:thin:@DBHost:DBPort:orcl","DBUser","DBPass");
        System.out.println("Test Connection ========== "+con);
        Statement st = con.createStatement();
        ResultSet rs = st.executeQuery("SELECT SYSDATE FROM DUAL");
        if(rs.next())
            ss="Command has been executed - Database has been accessed";
        else
            ss="Command has been executed - Database was not accessed";
    catch(Throwable t)
        System.out.println("Exception raised, command has NOT been executed");
        ss="Exception raised, command has NOT been executed";
        t.printStackTrace();
    return ss;
}Edited by: Rodolfo Ferrari on Jul 23, 2009 10:40 PM

Similar Messages

  • Client-cert auth impl in web.xml does not work in Oracle Application Server

    Hi,
    I am new to implementing security features on the web applications.. I have developed a new web service using jdev1012 and deployed in OAS 10.1.2. Its working fine according to the business requirements, but I am in need of implementing client-cert authentication to enable the web service available to only those who have client certificate.
    My server details are:
    Oracle Application Server 10g Release 2 (10.1.2)
    Server certificate is in place and SSL mode have been already enabled.. able to access my web service through https://<mydomain.com>/myws/TreqWS as well able to see the WSDL file through https://<mydomain.com>/myws/TreqWS?WSDL.
    I tried to include the following in my web.xml file as part of implementing CLIENT-CERT authentication.
    <security-constraint>
    <display-name>SecurityConstraint</display-name>
    <web-resource-collection>
    <web-resource-name>WSCollection</web-resource-name>
    <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    <login-config>
    <auth-method>CLIENT-CERT</auth-method>
    <realm-name>WSCollection</realm-name> <!-- am not sure about this realm-name and its purpose -->
    </login-config>
    It is not woking as expected, though I have restarted my oc4j container after including this content to the web.xml file. i.e, I am able to invoke the web service though my sample java client program, though I donot have client certificate/keystore.
    I believe I am missing something..Can anyone help me in this regard to implement CLIENT-CERT authentication successfully?
    Thanks,
    Ms

    I am having the same problem with doc and xsl. I have added this
    <mime-mapping>
    <extension>xls</extension>
    <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>
    <mime-mapping>
    <extension>doc</extension>
    <mime-type>application/msword</mime-type>
    </mime-mapping>
    to my web.xml. I even restarted the server. I still see doc and xsl in binary.
    Is there some other setting that needs to take place?
    I am using WL6.1 with fixpack 1.
    I can see the doc and excel files in the browser if I don't go through the weblogic
    server. That just confirms it's not my browser.
    Kumar Allamraju <[email protected]> wrote:
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    It works fine for me in 6.1 SP1.
    <br><br>
    If the following doesn't work , can you
    <br>try application/winword instead of application/msword?
    <p>--
    <br>Kumar
    <p>Siming Mu wrote:
    <blockquote TYPE=CITE>Hi,
    <p>I setup in my web.xml a mime mapping as follows,
    <p><mime-mapping>
    <br><extension>doc</extension><mime-type>application/msword</mime-type>
    <br></mime-mapping>
    <p>When I specify a test.doc url, the doc file appears in my browser
    as
    binary data
    <br>instead of download.
    <p>Please reference change request 055002, which decribes this problem. 
    According
    <br>to edocs, it has been fixed in wls6.1sp1.
    <p>But I am seeing it fixed.  Am I doing anything wrong? Thanks.
    <p>Siming</blockquote>
    </html>

  • Browser not working in Oracle Applicaiton Server

    Hye,Anybody Help me? i configure Oracle Application Server fine,but from IE browser or Netscape Browser when i do any thing it give me ... " download plugins " ,so how can i solve it
    thanking you
    Brijesh

    Hello Dear,
    i got the problem and it is with JINITIATOR.bcos onmy machine i alreadyyinstalled Oralce DEVELOPER 6i.and also Old Versition oF Jinitiaotor.when i run my 10g Application then It will also aks me INSTALL Jinitiator.So it is conflict with versition,
    Now can you tell me how to deinstall complete jinitiator ? bcos from Installer i can not install.So please give me an idea.
    Thanking you
    Brijesh

  • Form is not submitting through Oracle Application Server

    Hi Experts,
    We are creating one Java Application and deploy this java application on Oracle Application Server Enterprise Manager release 2 through War File.
    Now, There one Form on submitting calls procedure with some 42 parameter in that 20 are Oracle Types and remaining are simple varchar or number. when going to submit this form is not raise any database error or server error , but data is saved into database.
    We creating error log on database side as well as on Server side but we did not found any error.
    We are confused because remaining all form working fine as they call with same as procedure, only difference is that this form calls procedure which having 42 parameter with 20 Type and remaining simple varcahr or number. Other Forms procedure also having Oracle Types as a parameter.
    Could any of one help me out, Please ?

    The form HTML is incorrect.
      <form id="form1" name="form1" method="post" action"registration.php">
    you're missing a  = after action

  • EAS not running on Oracle Application Server, Oracle Enterprise Linux

    Okay, another question. EAS is up and running on Oracle Application Server, but the URL is unresponsive.
    In the eas log file, I see
    Exception message (Oct 25, 2009 11:33:03 AM):
    no environmentjni in java.library.path
    java.lang.UnsatisfiedLinkError: no environmentjni in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
    at java.lang.Runtime.loadLibrary0(Runtime.java:822)
    at java.lang.System.loadLibrary(System.java:992)
    at com.essbase.eas.server.AppManServlet.init(Unknown Source)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at com.evermind.server.http.HttpApplication.loadServlet(HttpApplication.java:2379)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4830)
    at com.evermind.server.http.HttpApplication.findServlet(HttpApplication.java:4754)
    at com.evermind.server.http.HttpApplication.initPreloadServlets(HttpApplication.java:4942)
    at com.evermind.server.http.HttpApplication.initDynamic(HttpApplication.java:1144)
    at com.evermind.server.http.HttpApplication.<init>(HttpApplication.java:741)
    at com.evermind.server.ApplicationStateRunning.getHttpApplication(ApplicationStateRunning.java:431)
    at com.evermind.server.Application.getHttpApplication(Application.java:586)
    at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.createHttpApplicationFromReference(HttpSite.java:1987)
    at com.evermind.server.http.HttpSite$HttpApplicationRunTimeReference.<init>(HttpSite.java:1906)
    at com.evermind.server.http.HttpSite.initApplications(HttpSite.java:643)
    at com.evermind.server.http.HttpSite.setConfig(HttpSite.java:290)
    at com.evermind.server.http.HttpServer.setSites(HttpServer.java:270)
    at com.evermind.server.http.HttpServer.setConfig(HttpServer.java:177)
    at com.evermind.server.ApplicationServer.initializeHttp(ApplicationServer.java:2493)
    at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1042)
    at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131)
    at java.lang.Thread.run(Thread.java:595)
    Warning message (Oct 25, 2009 11:33:03 AM):
    java.library.path=/app/oracle/product/OracleBI/server/Bin:/app/oracle/product/OracleBI/web/bin
    I assume that the problem is the java library path, which is pointing to directories related to my OBIEE installation, instead of a java environment somewhere in the hyperion install. If that's right, how do I change this?
    Thanks!
    Edited by: James@JHPWD on Oct 25, 2009 8:44 AM

    Do you have a resolution for this issue? I am encountering the same issue on Solaris 10 SPARC using Essbase 64bit, OAS and Shared Services.
    Thanks,

  • Webservice not created in oracle application server after deployment

    Hi,
    I just tried to deploy fulfillmentESB project(SOADemo Projects) from Jdev to Oracle App server control. But there was no webservice created in Oracle application server control under webservices link....plz help me...
    Actually the steps which i had followed to deploy that fulfillment project are:
    * right-click fulfillmentESB
    * select Register with ESB, Integration connection
    after which the fulfillment webservice can be seen in ESB control as well as application server control. But i could not able to see webservice created in application server control.
    Also i tried deploying the fulfillmentESB using EAR file - no use
    So kindly give me some steps to solve this issue...
    -Indhu

    I can see you also posted in the (proper) SOA Suite forum.
    Please do not cross-post unless you really have to (for example when in the other forum no one seems to have the answer).
    Jan Kettenis

  • Runtime.exec with spaces not working EVEN using String[]!!

    Hi everyone,
    I need to start the rmi registry from some code,and i need to pass it the classpath of two jars when initialising it. My problem is that the paths I set aren't taken when they contain a space.
    Here's the code:
    <code>
    String rmiRegistryCommandLine[] = new String[] {
    + System.getProperty("java.home")
    + "\\bin\\rmiregistry.exe\"",
    "-J-Djava.class.path=\""+System.getProperty("user.dir")+"\\MyJar.jar\"",
    "1099"};
                                            Runtime.getRuntime().exec(rmiRegistryCommandLine);
    </code>
    I know that Runtime.exec(String) tokenizes the input, which is why I'm not using it, but Runtime.exec(String[]) isn't supposed to tokenize the input. System.getProperty("user.dir") can contain a space, so I put quotes around that, but I need the -J-Djava.class.path in the same string. I tried breaking it up into two more separate strings but it didn't even run for normal non-space paths then. I am sure that if the whole -J-Dblah....upto MyJar.jar was in quotes then it would work, but I need the classpath in quotes separately as it could contain a space.
    Can anyone help me get this working?

    Ya, that's fine but the command line I want to pass is:
    d:\j2sdk1.4.0\bin\rmiregistry.exe -J-Djava.class.path=d:\my dir with spaces\MyJar.jar;d:\my more dir with spaces\MyJar2.jar 1099
    If I say
    arg[0]="d:\\j2sdk1.4.0\\bin\rmiregistry.exe";, that's finebut arg[1] is the problem
    if I say
    arg[1]="-J-Djava.class.path=d:\\my dir with spaces\MyJar.jar; d:\\my more dir with spaces\\MyJar2.jar";, then it definitely won't work on 9X machines and probably not on NT.
    if I break up arg[1] into:
    arg[1]="-J-Djava.class.path=";
    arg[2]="d:\\my dir with spaces\\MyJar.jar";
    arg[3]=";";
    arg[4]="d:\\my more dir with spaces\\MyJar2.jar";I'll need to put quotes around the two individual two class paths or else it won't work.
    I find though that if I put the classpath as follows
    d:\"my dir with spaces"\MyJar.jar then it seems to work.
    I think a regular expression function to search for any directory with spacees and then put quotes around it and reinsert it into the path would be the solution.

  • Scroll mouse not working in Oracle Applications!

    Hi All
    In most of the windows and forms, if not all, the scroll mouse doesn't works. I mean the scroll wheel doesn't works. Do we have to configure it?
    How to do this?
    Regards
    Rahman

    It would work only if you have the following:
    - Forms 10.1.2.2 (Or above)
    - Sun JRE 1.4.x (Or above)
    Btw, it works in Forms 4.5 - 6i client-server (Using specific mouse drivers)

  • The Runtime.exec methods doesn't work well on Solaris ???

    I have two threads and I set the different running time.
    I use Runtime.exec to a run the command and use Process to get the process.
    It works properly in the windows2000 platform.
    However, when I transfer the platform to Solaris...and run the program...
    Two threads always at the same time....It is very wired....I always debug
    for 2 days....
    (at first I run "vmstat 1 2" command, later I change to "ls","rmdir"....etc,
    all of them don't work.....
    If I close the Runtime.exec..........Everything works well......)
    And I study the API. I found this message...
    The Runtime.exec methods may not work well for special processes on certain
    native platforms, such as native windowing processes, daemon processes,
    Win16/DOS processes on Win32, or shell scripts. The created subprocess does
    not have its own terminal or console.
    Could someone share her/his experience.....:(
    And if any other way I can run command inside java code instead of
    Runtime.exec.....???
    Please reply my mail to [email protected] I do appreciate your kindly &
    great help!!!!!!!!
    This is my code.......
    import java.io.*;
    import java.lang.*;
    import java.util.*;
    * <p>ServerThread1</p>
    * <p>??�X???��?�D???�X???, "Vmstat 1 2".</p>
    class ServerThread1 extends Thread{
    private ServerAgent Sa;
    public ServerThread1 (String Name, ServerAgent Sa){
    super(Name);
    this.Sa = Sa; file://Assign ServerAgent reference Sa
    public void run(){
    while(true){
    try{
    Thread.sleep(5000);
    catch (Exception e){
    System.out.println("ServerThread1 fails");
    System.out.println("Thread1 is running.");
    try {
    Runtime rt1 = Runtime.getRuntime();
    Process proc1 = rt1.exec("mkdir"); ------>If I close
    rt1.exec , two threads works seperately...........:(
    catch (Exception e) {
    System.out.println("Thread1 Error");
    class ServerThread2 extends Thread{
    private ServerAgent Sa;
    public ServerThread2 (String Name, ServerAgent Sa){
    super(Name);
    this.Sa = Sa;
    public void run(){
    while(true){
    try{
    Thread.sleep(15000);
    catch (Exception e){
    System.out.println("ServerThread2 fails");
    System.out.println("Thread2 is running.");
    try {
    Runtime rt2 = Runtime.getRuntime();
    Process proc2 = rt2.exec("vmstat 1 2"); ----->If I don't run
    the rt2.exe, two threads work seperately....
    catch (Exception e) {
    System.out.println("Thread2 Error");
    public class ServerAgent{
    private Vector v1 = new Vector();
    private Vector v2 = new Vector();
    private Hashtable currentData = new Hashtable();
    private static String startUpSwap = null;
    private static String startUpMem = null;
    public static void main(String[] arg) {
    ServerAgent s = new ServerAgent();
    ServerThread1 st1 = new ServerThread1("Thread1",s);
    ServerThread2 st2 = new ServerThread2("Thread2",s);
    st1.start();
    st2.start();

    If I close the Runtime.exec..........Everything works
    well......)You don't empty the output of the command, that blocks the process.
    A citation from
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    Why Runtime.exec() hangs
    The JDK's Javadoc documentation provides the answer to this question:
    Because some native platforms only provide limited buffer size for standard input and output streams, failure to promptly write the input stream or read the output stream of the subprocess may cause the subprocess to block, and even deadlock.
    Try out something like this:
    String s;
    try {
       Process myProcess =
       Runtime.getRuntime().exec("ls -l"));
       DataInputStream in = new DataInputStream(
              new BufferedInputStream(myProcess.getInputStream()));
        while ((s = in.readLine()) != null) {
            out.println(s);
    catch (IOException e) {
        out.println("Error: " + e);
    }Another source of trouble under Unix is not having the correct permission for that user that executes the Java VM, which will be the permissions for the spawned subprocess. But this probably not the case, as you see something after exit.
    Regards,
    Marc

  • Can apex work without the oracle applications server? How?

    My question is just what the title says.
    Can apex work without the Oracle applications server?
    I've heard it needs a web server to work but not necessarly the oracle applications server.
    Is it true?
    With ONLY apache installed can apex work on top of it?
    Thanks
    Don't forget to assign points to those who help you! (Mark the thread Helpful/Correct)
    My Homepage
    Best Regards
    Edited by: Igor Carrasco on May 29, 2009 2:59 PM
    Edited by: Igor Carrasco on May 29, 2009 2:59 PM

    Hello,
    Take a look at the Installation Guide which covers all the different options you have (as there are a few variations) -
    http://download.oracle.com/docs/cd/E14373_01/install.32/e13366/toc.htm
    but yes, in short you can have a configuration where there is no external webserver which uses the embedded PL/SQL gateway.
    Hope this helps,
    John.
    Blog: http://jes.blogs.shellprompt.net
    Work: http://www.apex-evangelists.com
    Author of Pro Application Express: http://tinyurl.com/3gu7cd
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!

  • Developing for a Oracle Application Server with SSO

    Hello there,
    I'm developing an application (Java) that will be deployed as a partner application within an Oracle Application Server 10g at my client. This Oracle instance has a SSO already configured, and my app will use this Identity Manager (consuming the cookie). The problem is that at my company we don't have a SSO system configured, not even an Oracle Application Server, just a simple Oracle XE 10g to hold data. So I'm wondering how can I do to develop my application and test it.
    I was looking forward to install an OAS and configure an SSO to validate my implementation, but the download link provided by Oracle is broken (http://www.oracle.com/technology/products/ias/index.html). Another alternative that I thought of was to install an OC4J and configure a Java SSO to simulate the behavior of OSSO, and make my app the cookie set by it. But OC4J supports only til Servlet 2.4 and my app is using 2.5...
    And to complete, I cannot access my client's environment. I'm supposed to write a Deploying document telling him how to deploy my app and then try to access it through Internet.
    Does anyone have an idea of how can I develop and test my app in my company's environment?
    Thanks in advance,
    Bruno Krebs.

    Apache 2.0 based OHS is located in Oracle Application Server Companion CD.
    Pavna

  • Oracle Application Server 10g R2 installation on Oracle Enterprise Linux 5

    Hi there ...
    I want to install Oracle Application Server 10g R2 on Oracle Enterprise Linux 5. Can I get an installation instructions (or steps) for that?
    Oracle installation guide mentions Suse 9 & 8 and Red hat 3 & 2. There is nothing related to Oracle Enterprise Linux 5 or 4?
    Thanks

    Yes there is one for 10gR3 too:
    Note:465159.1 Oracle Application Server 10g (10.1.3) Requirements for Linux OEL 5 and RHEL 5
    Thanks
    Shail

  • Oracle application server backup

    hi friends
    I am working on oracle application server 10g environment. i regularly taking backup of infrastructure tire using RMAN . and monthly operating system backup of file systems. Is there any other method through i can backup application server that will produce zero data loss.

    dbaforu wrote:
    hi friends
    I am working on oracle application server 10g environment. i regularly taking backup of infrastructure tire using RMAN . and monthly operating system backup of file systems. Is there any other method through i can backup application server that will produce zero data loss.See the following link :
    http://download.oracle.com/docs/cd/B14099_19/core.1012/b13995/br_tool.htm

  • FORM RUNTIME record=collect is not working.

    Hi
    FORM RUNTIME record=collect is not working which is set to user level.what to do?
    rgrds

    Pl post details of OS and EBS versions, along with the complete steps you took to enable this profile option. What does "not working" mean ?
    MOS Doc 438652.1 - R12: Forms Runtime Diagnostics (FRD), Tracing And Logging For Forms In Oracle Applications
    HTH
    Srini

  • [svn] 4193: Bug: LCDS-517 - Reliable messaging destinations created using runtime configuration (bootstrap service) not working.

    Revision: 4193
    Author: [email protected]
    Date: 2008-11-26 11:40:05 -0800 (Wed, 26 Nov 2008)
    Log Message:
    Bug: LCDS-517 - Reliable messaging destinations created using runtime configuration (bootstrap service) not working.
    QA: Yes
    Doc: No
    Checkintests Pass: Yes
    Details:
    * Foundational update to include destination config in what we collect for runtime config exchange with new clients for destinations with network/reliable=true (LCDS only).
    * Also typo in comment in AbstractConnectionAwareSession fixed.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/LCDS-517
    Modified Paths:
    blazeds/trunk/modules/core/src/flex/messaging/AbstractConnectionAwareSession.java
    blazeds/trunk/modules/core/src/flex/messaging/Destination.java
    blazeds/trunk/modules/core/src/flex/messaging/services/AbstractService.java

    Revision: 4193
    Author: [email protected]
    Date: 2008-11-26 11:40:05 -0800 (Wed, 26 Nov 2008)
    Log Message:
    Bug: LCDS-517 - Reliable messaging destinations created using runtime configuration (bootstrap service) not working.
    QA: Yes
    Doc: No
    Checkintests Pass: Yes
    Details:
    * Foundational update to include destination config in what we collect for runtime config exchange with new clients for destinations with network/reliable=true (LCDS only).
    * Also typo in comment in AbstractConnectionAwareSession fixed.
    Ticket Links:
    http://bugs.adobe.com/jira/browse/LCDS-517
    Modified Paths:
    blazeds/trunk/modules/core/src/flex/messaging/AbstractConnectionAwareSession.java
    blazeds/trunk/modules/core/src/flex/messaging/Destination.java
    blazeds/trunk/modules/core/src/flex/messaging/services/AbstractService.java

Maybe you are looking for

  • Fire OutBound Plug --- Not Working

    Hi, I have a Window with 2 Views. I have put 2 Naviagtional Links for the Plugs accordingly. I have a Button/Link available in View1 and want to Navigate to View2 on the action of the Button or Link. Strange thing is , When I perform the action, noth

  • Migrate old keychain to new computer

    Hi all I'm preparing to buy a Mac Mini to replace my sadly moribund iBook G3. One thing that I am quite concerned about is that my keychain should be successfully migrated, since it contains crucial password information that is not stored elsewhere.

  • Folders named "pairs" are a problem - REPRODUCIBLE BUG

    MAKE SURE YOU BACKUP YOUR DB BEFORE TRYING TO DO THIS I was able to reproduce this problem with LR 2.0 on Windows XP. If I'm importing a folder and any of the imported subfolders are named 'pairs', I will not see the image count in the library (I get

  • Would like to see on line the options (cost) for local service only

    I saw a page the other day, and there was a local plan for $18.17  Now I can't find it back, no matter how much searching I do.  I an area code 812-prefix 794. Now the cheapest I can find is the Verizon Unlimited Local Service....at this link.  http:

  • Updating old projects

    I bought a new Mac Pro and installed FCP 6. When I try to open projects created on the G5 , it opens the browser and viewer, but none of the video and the timeline is gone. The video was captured on a Pinnacle Cinewave card so that may be a codec pro