Is it possible to trap a Java  Exception from within an XPRESS Rule?

Hellos.
I have a rule which invokes a Java method which queries an oracle DB table.
Due to network problems the oracle DBMS may reset the connection in some situations... which results in my Rule's invokation of the method giving an XPRESS exception because of an IO Exception. I want the chance to retry the query at least once before exiting the Rule and returning the error.
If it is possible to detect this Exception would someone please let on how its done.. I cant change the Java method all I wish to do in my Rule is to check if the <invoke></invoke> block threw an exception.
regards
GF

hi,
You can call a .exe from a standalone application code, use the following piece of code
java.lang.Runtime.getRuntime().exec("sol.exe");
hope this is useful.
cheerz
ynkrish

Similar Messages

  • Possible to create a JAR file from within a java app?

    Is it possible to create a jar file from within a java application?
    Can it be done more elegantly than by spawning-off another
    process with the Runtime and exec() portions of the api?
    Thanks
    Scott

    Thanks! I was mislead by the API notes for java.util.jar:
    The JarOutputStream class is used to write the contents
    of a JAR file to any output stream.
    I was looking for a class or method to make jar files.
    Seems this is it ;)
    Thanks
    Scott

  • Is it possible to invoke a Java class from Data Services 4.0?

    Is it possible to invoke a Java class from Data Services? I have a query transform with a varchar column which I want to run an external java class against to encrypt the string value. In the Management Console, I created an adapter of type TestAdapter and referenced my jar file in the Classpath section, but when I create a Datastore of type Adapter I can't import any functions related to my java class? It seems like I need to create a new Adapter type similar to the TestAdapter with the 'Adapter Class' set to my java class? I can't figure out how to do this - which is the correct approach and is there some documentation available? thanks!

    First u nees to imoprt the class which u are doing right
    then u need to call the function of the class , and then you can put the value in a string .
    DbCon.function()
    String data = DbCon.db;
    where db is a string in DbCon
    Cheers
    Varun Rathore

  • Find out who catches exception from within exception

    Hi,
    I am writing some generic Exception for our project. The aim is to simplify exception handling by making the exceptions log the necessary information with Log4J.
    It seems pretty easy to find out which class actually threw the exception (top of stack trace) but I would much rather like to log the exception in the name of the class that will catch the exception.
    The problem is that the stacktrace (it can be retrieved within an exception as of J2SE 1.4) does not contain information about which class will actually be catching the exception.
    Is there any way to accomplish that? Would be very grateful if someone could point me into the right direction if there is a possibility.
    Thank you very much in advance
    Greets Robbi

    Thanks for the quick reply.
    What I actually really wanted is to log from within the Exception. Right now I am doing this from within the Exceptions constructor.
    I see your point with the constructor being supposed to be lightweight, but in most cases the logging will be turned off and log4J does not take a lot of time to find that out.
    The logging within the catch blocks is what we wanted to circumvent as that would be the same in all catch blocks. Additionally it would be easy to simply change the topmost Exception in our hierarchy to log somewhere else instead.
    Performance is not too crucial on our application, but traceability is, as a lot of money is tied to a single transaction. That is why we decided to for Exceptions to log, as thus even when a developer would forget to log, the exception is still logged.
    Anyway, I thought that it is quite likely not possible to determine who catches an exception from within that exception. I guess the virtual machine wouldn't like to unseal that information. Maybe this is something that might work in a future Java version.
    Thanks for the input anyway.
    Regards Robbi

  • Accessing java objects from within javascript

    Hello,
    Anyone with an idea of a useful toolkit for accessing java objects from within javascript will be much appreciated.
    Thanks in advance,
    Antana.

    What do you mean by accessing Java objects? Do you mean interacting with an applet via JavaScript? Something else?

  • Is it possible to call a java function from plsql?

    I have a plsql script which loads data in to a table. One of the fields is a notes field. I would like to use advance offerings of java to manipulate the data before inserting. Is there away I can pass the data to a java function and have it return the manipulated data?
    Thanks
    Aaron

    You can use java stored procedure to call java function from plsql.
    1. Create a java class with a static function(which will be called from plsql).
    2. Compile and load the class into database using LOADJAVA command.
    3. Create a wrapper stored procedure or function in plsql which calls the above java function.
    4. Access this plsql procedure like normal database procedure. This will invoke underlying java function in which you can do all the processing and return result.
    Refer this url for help on implementing above steps :
    http://otn.oracle.com/tech/java/jsp/pdf/developing_o8i_apps_with_plsql_and_java_twp.pdf
    Samples on java stored procedure :
    http://otn.oracle.com/sample_code/tech/java/jsp/oracle9ijsp.html
    Chandar

  • Calling a adf commandlink (or other java method) from within a outputtext

    Is it possible to call a commandLink to call an existing java bean/function within an outputText?
    For example:
    Say I had an outputText that dumped a /etc/hosts file and I wanted to put in a command link to ping each host and pass the particular IP address to it. What would be the best method for doing that?
    135.122.29.122 host1.me.com PingMeLink
    135.122.29.117 host2.sd.me.com PingMeLink
    So, can I embed this in an outputText somehow or is there a better way to do this?
    <af:commandLink text="PingMeLink"
    action="#{NetworkController.PingAHost}"/>
    Thanks for your help!

    That foreach or iterator sounds like a potential solution. I was thinking I could format the output like this:
    Host Type Interface IP Address Hostnames Links
    Type
    Local Host Loopback 127.0.0.1 localhost PingMe
    MXX Public 135.9.161.146 r30mss.gbcsitac.avaya.com r30mss PingMe
    MXX Private 192.168.1.1 mxx1 PingMe
    MYY Public 135.9.161.141 r30mas1.gbcsitac.avaya.com PingMe
    MYY Private 192.168.1.250 mas1 r30mas1.30dom.local r30mas1 PingMe
    Would my jsp would look something like this?:
    &lt;af:foreach var="item" items="#{NetworkController.ipinterfaceList}"&gt;
    &lt;af:outputText value=#{item.hostType} #{item.InterfaceType} #{item.ipAddress)  #{item.hostnames}"/&gt;
    &lt;af:commandLink text="PingMe" action=#{NetworkController.PingHost}"/&gt;
    &lt;/af:foreach&gt;
    Would this work? In my backing bean java NetworkController::PingHost code, how do I get the specific item.ipAddress that was clicked on via my link? Is the specific collection item, accessible/passed to my backing been method?
    Thanks!

  • How can I call a java class from within my program?

    I was wondering if there's a platform independent way to call a java class from my program.

    Here's my scenario. I'm working on a platform independent, feature rich, object-oriented command prompt program. The way I'm designing it is that users can drop classes they write into my bin directory and gain access to the class through my program. For example, they drop a class named Network.class in the bin directory. They would type Network network at my command prompt and gain access to all the methods available in that class. They can then type system.echo network.ipaddress() at my prompt and get the system's ip address. I have it designed that there's a server running in the background and the clients connect to my port. Once connected the end-user can enter their user name and password and gain access to the system. When they type a command they actually call another java program which connects to my server using a seperate thread. They can then communicate back and forth. I have it set that everything has a process id and it's used to keep track of who called what program. Once the program is done it disconnects and closes. Rather than getting into the nitty gritty (I didn't want to get into heavy detail, I know how everything will work) I'm really interested in finding out how I can call a java program from my program. I don't want it to be part of the app in any way.

  • Calling a java application from within another class

    I have written a working java application that accepts command line parameters through public static void main(String[] args) {} method.
    I'm using webMethods and I need to call myapplication from within a java class created in webMethods.
    I know I have to extend my application class within the webMethods class but I do not understand how to pass the parameters.
    What would the syntax look like?
    Thanks in advance!

    why do you want to call the second class by its main method ??
    Why not have another static method with a meaningfull name and well defined parameters ?
    main is used by the jvm as an entry point in your app. it is not really meant for two java applications to communicate with each other but main and the code is not really readable.
    Have a look at his sample
    double myBalance = Account.getBalance(myAccountId);
    here Account is a class with a static method getBalance which return the balance of the account id you passed.
    and now see this one, here Account has a main method which is implemented to call getBalance.
    String[] args = new String[1];
    args[0] = myAccountId;
    Account.main(args);
    the problem with the code above is
    main doesn't return anything so calling it does do much good. two the code is highly unreadable because no one know what does the main do... unlike the sample before this one where the function name getBalance clearly told what is the function doing without any additional comments.
    hope this helps.... let me know if you need any additional help.
    regards,
    Abhishek.

  • Is it possible to adjust MAX scaling values from within LV?

    I'd like to adjust MAX scaling values from within a LV application- is this possible?
    This is to be used for a 'calibration' feature of an application.

    Yes you can:
     (I have never done it actually)
    Quote from the online help:
    Saves the specified custom
    scale to MAX.
    More info.
    Ton
    Message Edited by TonP on 11-19-2008 08:53 PM
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!
    Attachments:
    Example_VI_BD.png ‏2 KB

  • Executing a Java Program from within a Java Program

    I need to execute the following Java Program from withing another Java Program. The office toolbar command line is
    D:\WINDOWS\system32\java.exe -cp E:\Development\Eclipse\UpdateServer\Classes -server -showversion UpdateServer
    I can find no combination of ProcessBuilder commands, including those that include "Cmd.exe /c" that will make this program run from within another Java Program. All the examples I can find only show how to run Windows *.exe programs. I keep getting error 123 from ProcessBuilder.start(), but I can find no documentation for error 123.

    Assuming your code didn't get mangled by the forum
    (it's missing one "), it may be that your "-cp
    E:\\Develop.." argument is getting quoted as it has a
    space in it; try passing "-cp" and "E:\\Develop..."
    as two arguments.That worked; specifically the following tested OK:
    ProcessBuilder pb = new ProcessBuilder("D:\\WINDOWS\\System32\\Java.exe", "-cp", "E:\\Development\\Eclipse\\UpdateServer\\Classes\\", "-server", "-showversion", "UpdateServer" );
    pb.directory(new File("E:\\Development\\Eclipse\\UpdateServer\\Classes\\"));
    try{
         Process p = pb.start();
         InputStream is = p.getErrorStream();
         InputStreamReader isr = new InputStreamReader(is);
         BufferedReader br = new BufferedReader(isr);
         String line;
         while ((line = br.readLine()) != null)
              System.out.println(line);
         p.waitFor();
    }catch(IOException ioe){
    I was sure I tried that exact same code before, and it did not work, but now it does, at least at the top level (when it is in main of a test program). I will have to wait to try it until later when it is buried deep in a subroutine.

  • How to trap a java exception where java is invoked from a .bat file

    Hi,
    Jgurus,
    i have problem here, i am invoking a batch file from my java class using the command Runtime.getRuntime().exec(batch1.bat) now this file is setting some classpath and invoking batch2.bat with some parameters and this batch2.bat is invoking java command which is throwing a exception now i want trap this execption.
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    :::::code for batch1.bat:::::
    set classpath=d:\com\tech\sun\tcc.jar;d:\com\tech\sun\parameter.jar
    set TMMHOME=d:\TMM
    cd %TMMHome%\bin
    testcom.bat -i D:/test1.xml -o D:/testresult.xml
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    :::::code for testcom.bat:::::
    %_JAVACMD% -classpath %LOCALCLASSPATH% com.tech.sun.parameter
    now when java is invoked it throws an error :
    Exception in thread "main" com.tech.test.runner.RunnerException: com
    .snstech.testcompanion.runner.RunnerException: com.snstech.testcompanion.runner.
    RunnerException: The specified constructor for aclass does not exist
    pls. help me in this issue .....
    thanks in advance
    Abhijit
    [email protected]

    >
    You can read the output stream of that other process.
    Process p = Runtime.getRuntime().exec(...);
    InputStream theOutput = p.getInputStream();
    // or you may want the p.getErrorStream()
    // now read and parse theOutputAre you sure that will work from an exe in a batch file? It was my understanding that a batch file runs in a shell (a process.) When an executable runs in the batch file a seperate process is created. Thus I would expect that it would have its own stdin/out/err in that case.
    However, in newer versions of windows the following will redirect the output to files (there is NO space between the '2' and the '>')
    java.exe MyClass >out.txt 2>err.txt
    This will work if the above does not (and if your version of windows supports it.)

  • Is it possible to call a java method from servlet

    Hi All,
    I am trying to import a java class to my servlet and call a method of that class, is this possible. I am getting an error while importing the class.
    I am using tomcat, have put my class files in th path
    \WEB-INF\classes\com\kiran
    My java goes like this
    package com.kiran;
    import java.sql.*;
    import javax.sql.*;
    public class DbCon
    { Connection con=null;
    public Connection getCon()
    -----return con;
    catch(Exception e){ return con; }
    and my aim is to call getCon() from my servlet. which is as follows
    package com.kiran;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import com.kiran.DbCon;
    public class check extends HttpServlet
    DbCon db;
    i am not able to compile my servlet, err is --> cannot find symbol DbCon..
    How can i import the class, do i require any entries in web.xml ?
    expecting your advice..
    Thanks in advance
    Best Regards,
    Kiran

    Ok, first off, if you are testing in tomcat (and as you said you are placing the class files in the path), you already compiled this classes, right? Otherwise I don't see how you placed your classes in /WEB-INF/classes/. Note that you will need two class files (based on your code. If not, then I'm missing part of the question. Typically, your IDE will help you with this problem a lot. The only thing that seems confusing is the catch (Exception e) statement which needs to be as part of a method (I assume this is a typo on your part).
    If your problem is at runtime, don't forget to configure your web.xml to see your servlet.

  • How can I compile and run other java classes from within an application?

    Hello there everyone! I really hope that someone can help me. I am writing a program that must be able to compile and run other java classes that are in different files, much like development environments like Kawa or Forte allow you to do.
    There has to be a way of doing this ( I hope!! ), but i can't seem to find it!!
    I have tried using this command to compile:
    Runtime.getRuntime().exec ("c:\\programs\\javac className.java");
    ...and this one to run:
    Runtime.getRuntime().exec ("c:\\programs\\java className");
    ...but neither works!!! I can compile and run classes that are in the same file as my application, but I can't get it to work at all for files in different directories or files.
    PLEASE, PLEASE, PLEASE help me - i've run out of ideas, and i need this to be working in 3 days!!!
    Thank you very much for any help anyone can give me, I really appreciate it!! Thanks again!!
    Adrian ( ...in distress!! )

    public class JavaCompiler{
       public static void main(String[] args)throws Exception{ //sorry bout the laziness
          if(args == null || args.length != 1){
             System.out.println("Usage: java JavaCompiler MyClass.java");
             System.exit(0);
          String className = args[0];
          Runtime rt = Runtime.getRuntime();
          Process p = rt.exec("javac " + className); //consider setting cpath for this
          p.waitFor();
          //now try to run after it is done.
          p = rt.exec("java " + className.substring(0, (className.length() - ".java".length()));
          p.waitFor();
          //do some other stuff
    }This should get you going. You may consider looking into the System.getProperty() method in order to determine the type of OS it is running on in order to findo out what command to run. I know that the sun tool listed above is nice, but by my understanding the sun tools provided are not guaranteed to stay the same. I'm no expert on this matter, but that is one of the reasons there is no API documentation for those tools. Also, I don't believe those tools come packaged with the JRE. (Of course if you are making an IDE it will be expected that the user has an sdk installed. Good luck with figuring this thing out.

  • Running Java applications from within JSP

    Hi Folks,
    First of all, apologies if this post is either 1) in the wrong forum or 2) a horrendous mis-application of java/JSP :D
    I have a java test harness application that I have created, it runs from the command line, taking two arguments (the name of the app you want to test and the location of the properties file) and it then looks up the app in the properties file and tests the application - writing results to html reports and errors to logs... all pretty standard so far.
    The apps i normally test are usually on an app server (normally IBMs WAS), so I thought, why dont I create a Web Application with a nice JSP page listing all the applications that can be tested(extracted from the properties file) and allow the user to go to the jsp and just click the "test this service" button or "view results" button for any service - just to make it more manageable.
    So I have created the JSP page with the list of applications, and the links to all the result.html files - so now I just need to implement the functionality to be able to hit the link "Test now" and the test harness runs in the background.
    Does anyone please have any ideas?
    The best i came up with was creating a link to a new jsp page that had the code on it to create the main Test Harness object and then calling the execute() method - however, when i press the link i get taken to the page but my tests arent run? (this test was run on Tomcat if that makes any difference)
    Any ideas? of any better ways to approach the task?
    Thanks in advance guys!!

    Start with Java EE tutorial part II: [http://java.sun.com/javaee/5/docs/tutorial/doc/bnadp.html].
    To create a Servlet you basically just extend HttpServlet and implement the appropriate methods, such as doGet() for GET requests and doPost() for POST requests. To run it, you need to define it in the web.xml and map it on an appropriate url-pattern with which you want to invoke the servlet by URL.
    To fullfill your requirement, I think implementing doGet() ought to be sufficient. E.g.
    yourpackage.YourServlet.javaprotected void doGet(HttpServletRequest request, HttpServletResponse response) {
        YourJavaClass yourJavaClass = new YourJavaClass();
        Object someResult = yourJavaClass.doSomething();
        request.setAttribute("someResult", someResult);
        request.getRequestDispatcher("yourPage.jsp").forward(request, response);
    }yourPage.jsp<p>Result: ${someResult}</p>web.xml<servlet>
        <servlet-name>yourServlet</servlet-name>
        <servlet-class>yourpackage.YourServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>yourServlet</servlet-name>
        <url-pattern>/yourServlet</url-pattern>
    </servlet-mapping>Invoke it by [http://localhost:8080/yourContext/yourServlet].

Maybe you are looking for

  • Import Photoshop Spot channels as Overprint

    Hi, I've had a few issues with this recently, which has led me here... When you have a Photoshop file with a Spot channel, it works in Photoshop as expected... The spot channel Overprints the rest of the image (well, the CMYK remains unchanged). This

  • Sound for Sending Mail

    I've checked all through the forum and can't find an answer, so I hope this is not a repeat... Is there a way to have a different sound (that I choose) play for sending mail versus receiving mail? I can change the incoming sound in preferences and I'

  • Can you re-order images in a folder?

    This should be simple, but I can't figure it out. If I import a folder of images and rate them, I then want to re-order them also. But I don't seem to be able to drag and drop the thumbnails to a new position. Is there a trick to this? I've tried it

  • Reader 10.1.2 incorrectly assumes my printer is not duplex

    I have a Canon ip4500 printer.  I'm running OSX  10.7.3 on my MacBook. The printer dialog box in Reader 10.1.2 doesn't even give me the option of choosing duplex printing or not.  Does anyone know where the printer specification files are that Reader

  • Apple ID problems

    I recently had a change in my primary email account and successfully reset that in my apple account. Now however when I try to log into the App Store it still shows my old username and will not let me sign to to buy any apps. How do I remedy this