Catching an exception (help)!!!

Hi everyone, the problem i have is when the user enters a number that is out of bounds (higher or lower than the excepted values it should prompt the program to write to the screen "out of range, try again" or something along those lines.
However, it instead just prints "error - program terminated" which is the message that should be printed when there is a different problem within the program.
Can anyone help me get the program to print the correct messages, you can see what i mean from the code:
import java.io.*;
import java.util.ArrayList;
public class FlatCost { 
    ArrayList floors = new ArrayList();
    public FlatCost(String filename)  {   
        try    {     
            readDataFromFile(filename);
            BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
            int floor;
            int rooms;     
            String another = "y";     
            while(another.equalsIgnoreCase("y"))      {
                System.out.print("\nEnter floor number (0 for ground): ");
                floor = Integer.parseInt(in.readLine());      
                if(floor < 0 || floor > floors.size())        {
                System.out.println("floor out of range, try again");       
            else        {
                System.out.print("\nEnter no. rooms: ");
                rooms = Integer.parseInt(in.readLine());         
                if(rooms < 0 || rooms > ((String[])floors.get(floor)).length)          {
                    System.out.println("rooms out of range, try again");         
                else          {
                    System.out.println("\nThe cost of a "+rooms+"-room flat on floor "+floor+" is "+                                  
                    ((String[])floors.get(floor))[rooms+1]+" per month");
                    System.out.print("\nAnother? (y/n): ");
                    another = in.readLine();         
        catch(Exception e){
            System.out.println("error - program terminated");
public void readDataFromFile(String filename)throws Exception {
BufferedReader br = new BufferedReader(new FileReader(filename));
String line = "";
while((line = br.readLine()) != null)
floors.add(line.split(" "));
br.close();
public static void main(String args[])throws IOException{
new FlatCost(args[0]);
}any help is appreciated
thanks
Sarah x

I barely know where to begin.
Start by printing out the stack trace when you catch an exception. That'll give you more information than the message you're printing out. You know the program is terminating - you need to know why.
You're writing in a VERY procedural style. There's little or nothing object-oriented about what you're doing.
You've got a bunch of stuff in that constructor that really doesn't belong there. You shouldn't have code to continuously ask a client for a floor and room number in a constructor. That really belongs in an application that drives the object, like the main method that you wrote.
Your FlatCost can read in a file that contains floor/room/price information, but if I were writing the application I'd read it in and store it in the ArrayList as you've done. Then I'd have a getCost() method that would take floor and room count as parameters and return the total cost.
Learning how to program is learning how to debug. I'd rewrite things a little bit and put System.out.println() statements into the code to narrow down exactly where the error was occurring and why. It won't take you long to figure it out. You don't even need a fancy debugger or IDE.

Similar Messages

  • OutOfMemory Exceptions on Servlets, Try-Catch unable to help

    Hi, I'm playing with Java servlets right now and I seem to be getting some OutOfMemory errors. The weird thing is that even though I had identify the souce of error and tried to enclose it with a try-catch, the exception still occurs. Why is that so?

    OutOfMemoryError is actually a java.lang.Error, not a RuntimeException. So if you use a try/catch like this
    try {
      // stuff
    } catch (Exception e) {..}Errors will fall through, since Error is not a subtype of Exception. (Check the API.)
    You can catch it by catching Error or Throwable, like this:
    try {
      // stuff
    } catch (Error e) { //  this is rarely a good idea
    }But you normally wouldn't want to do this. When there's no memory left, there's not a whole lot you can do about it, and most of the code you might want to put inside the catch block will merely throw another OutOfMemoryError.
    As voronetskyy said, you're either creating too many (or too large) objects (typically in an endless loop), or you have specified too little memory for your application.

  • How to get details about Exception catched in Exception branch of the Block

    Hello Experts,
    Is it possible to get details about Exception catched in Exception branch of the Block in Integration Process (BPM)?
    In the Exception branch System Error is catched, but from time to time different type of System Errors are happening during sync call to WebService - Connection Timeout, Connection Refused, UnknownHost, etc.
    So the task is somehow to map the type of System Error to the response. I was trying to create a mapping using as source the message which is coming from the Adapter after the sync call, but the mapping is failing with "No Source Payload" error.
    Maybe the description is somewhere in Header or Dynamic configuration?
    Or it is possible to access it somehow with JAVA-maping?
    Thanks for your help!

    Hey,
          the message from the exception can be utilized by using alerts(in order to mail,sms r fax). but otherwise its not possible using mappings or container.
    check this link for alert configuration.
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step

  • Catching an exception thrown from another thread

    I have a SocketServer that creates new threads to handle incoming clients. If one of the threads throw a SQLException is it possible to catch that exception in the SocketServer that created that thread.
    I tried implementing this code and I cannot get the server to catch an exception thrown in the thread. Are my assumptions correct?
    I was reading something about Thread Groups and implementing an uncoughtException() method, but this looked like overkill.
    Thanks for your time!
    Some Example code would be the following where the ClientThread will do a database query which could cause an SQLException. I'd like to catch that exception in my Socket Server
          try
                 new ClientThread( socketServer.accept() , host, connection ).start();
          catch( SQLException e )
                 System.out.println( "DataSource Connection Problem" );
                  e.printStackTrace();
          }

    hehe, why?
    The server's job is to listen for an incoming message from a client and pass it off to a thread to handle the client. Otherwise the server will have to block on that incoming port untill it has finished handling the client and usually there are many incoming clients continuously.
    The reason I would want to catch an exception in the server based on the SQLException thrown in the thread is because the SQLException is usually going to be due to the fact the datasource connection has become unavalable, or needs to be refreshed. This datasource connection is a private variable stored in the socket server. The SocketServer now needs to know that it has to refresh that datasource connection. I would normally try to use somesort of flag to set the variable but to throw another wrench into my dilemma, the SocketServer is actually its own thread. So I can't make any of these variables static, which means I can't have the thread call a method on teh socket server to change the status flag. :)
    I guess I need implement some sort of Listener that the thread can notify when a datasource connection goes down?
    Thanks for the help so far, I figured java would not want one thread to catch another thread's exceptions, but I just wanted to make sure.

  • Catching an exception within a JSP

    Hi all,
    I need to catch an exception in a JSP before the errorPage handles it. Have tried with try-catch but it seems like the exception is thrown to the errorPage anyway. Do you know of any technique to handle this.
    In other words: I would like to specify program logic for one exception within the JSP itself. Let us say Customer.Authenticate() throws an Exception when the given e-mail is not included in customer-DB. I would like to append logic instead of being redirected to errorPage.
    Anyone done this, can it even be done?
    ,Chr

    I would try keeping the error page as it is and still adding the logic in the catch block. If that does not help, then remove the error page and use <jsp:forward> (after your logic) in the catch block to explicitly go to the error page.
    or if you want to process that logic anyways in case of an exception, try adding your logic in the finally block.

  • Write and read txt files and catch the exceptions

    hey everyone, im in a bit of a bind. im trying to set up this try catch statement. here is what i have for code so far.
    import java.util.Scanner;
    import java.io.*;
    public class Warning
        //   Reads student data (name, semester hours, quality points) from a
        //   text file, computes the GPA, then writes data to another file
        //   if the student is placed on academic warning.
        public static void main (String[] args)
         int creditHrs;         // number of semester hours earned
         double qualityPts;     // number of quality points earned
         double gpa;            // grade point (quality point) average
         String line, name, inputName = "students.dat";
         String outputName = "warning.dat";
         try
              Scanner FileScan1 = new Scanner (new File("students.dat"));
              // Set up scanner to input file
              // Set up the output file stream
              // Print a header to the output file
              outFile.println ();
              outFile.println ("Students on Academic Warning");
              outFile.println ();
              // Process the input file, one token at a time
              while (FileScan1.hasNext())//there is another line...
                  {               // Get the credit hours and quality points and
                   // determine if the student is on warning. If so,
                   // write the student data to the output file.
              // Close output file
         catch (FileNotFoundException exception)
              System.out.println ("The file " + inputName + " was not found.");
         catch (IOException exception)
              System.out.println (exception);
         catch (NumberFormatException e)
              System.out.println ("Format error in input file: " + e);
    }I am pretty sure the layout is good to go, but first and foremost that try statement is hanging me up. Could someone give me some suggestions about how i should set this up.
    i want to read in this students.dat file, then output another file called warning.dat.
    Thanks i really appreicate the help.

    no, i was really hoping to just see if the way it is
    set up it will be doable, that way i wouldn't be
    working on code that was impossiable to sort through
    properlyFair enough.
    One thing I'd suggest is that if you're really basically only going to be printing the exceptions, and since that is the top-level method (main) --
    I'd instead just add some "throws" clauses to main, get rid of the try/catch stuff, and just let the VM handle the exceptions for you. It will print them, just like you're doing, except that it will also print the stack traces, which you are not doing.
    If you're going to handle exceptions, it's better to actually do something about them rather than just print them - otherwise you might just as well let the runtime do that for you.

  • Can i catch an exception from another thread?

    hi,guys,i have some code like this:
    public static void main(String[] args) {
    TimeoutThread time = new TimeoutThread(100,new TimeOutException("超时"));
    try{
    t.start();
    }catch(Exception e){
    System.out.println("eeeeeeeeeee");
    TimeoutThread will throws an exception when it runs ,but now i can't get "eeeeeeeeeee" from my console when i runs the main bolck code.
    i asked this question in concurrent forums,somebody told me that i can't.so ,i think if i can do this from aspect of jvm.
    thank you for your help
    Edited by: Darryl Burke -- Double post of how to catching exceptions from another thread locking

    user5449747 wrote:
    so ,i think if i can do this from aspect of jvm. What does that mean? You think you'll get a different answer in a different forum?
    You can't catch exceptions from another thread. It's that easy. You could somehow ensure that exceptions from that other thread are always caught and somehow passed to your thread, but that would be a different thing (you would still be catching the exception on the thread it is originating from, as is the only way).
    For example you can use setUncaughtExceptionHandler() on your thread to provide an object that handles an uncaught exceptions (and you could pass that uncaught exception to your other thread in some way).

  • Urgent: How can I catch the exception when application exit by accident

    Can anyone give me advice and idea?
    I want to catch the exception when application goes down by accident for example: Power off, turn off the machine without closing the appliction properly.
    Because I want to notify the server and remove it from register.
    How can I do this????
    Please help,
    Thanks very mich,
    Peter

    Shrubz,
    I tested my application as follows:
    1. start rmiregistry
    2. start rmi server
    3. start two clients
    I printed out the client's object information as below:
    first clinet:
    RemoteObserver is com.ss8.qos.qcsm.policy.policyui.PanelMain_Stub[RemoteStub [ref: [endpoint:[192.168.70.237:4706](remote),objID:[-73a6662b:e75af455a5:-8000, 0]]]]
    second client:
    RemoteObserver is com.ss8.qos.qcsm.policy.policyui.PanelMain_Stub[RemoteStub [ref: [endpoint:[192.168.70.237:4711](remote),objID:[-73a6665a:e75af48703:-8000, 0]]]]
    Now I stop the second client by clicking ^C (ctrl c)
    I noticed that this client has not been removed from the server register (Vector).
    next, I am working on first client for example add one record. After server received this record, it will update all clients who have already registered with server. Because now in the server register there are two clinets (first and second), so it will try to update two clients. The exception will be thrown when server tries to update second client which has already been stoped. I used printStackTrace() to print out the message as follow:
    Catch ConnectException
    Connection refused to host: 192.168.70.237; nested exception is:
         java.net.ConnectException: Connection refused: no further information
    java.rmi.ConnectException: Connection refused to host: 192.168.70.237; nested exception is:
         java.net.ConnectException: Connection refused: no further information
    java.net.ConnectException: Connection refused: no further information
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
         at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
         at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
         at java.net.Socket.<init>(Socket.java:269)
         at java.net.Socket.<init>(Socket.java:98)
         at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:29)
         at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:124)
         at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:497)
         at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:194)
         at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:178)
         at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:87)
         at com.ss8.qos.qcsm.policy.policyui.PanelMain_Stub.update(PanelMain_Stub.java:53)
         at com.ss8.qos.qcsm.policy.policydb.Observable.performNotify(Observable.java, Compiled Code)
         at com.ss8.qos.qcsm.policy.policydb.Observable.notifyObservers(Observable.java:71)
         at com.ss8.qos.qcsm.policy.policydb.PolicyServer.ServerAddPolicy(PolicyServer.java:102)
         at java.lang.reflect.Method.invoke(Native Method)
         at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:237)
         at sun.rmi.transport.Transport$1.run(Transport.java:140)
         at java.security.AccessController.doPrivileged(Native Method)
         at sun.rmi.transport.Transport.serviceCall(Transport.java:137)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:422)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:634)
         at java.lang.Thread.run(Thread.java:479)
    *** end here ***
    I don't see any information related to object ID. How can I handle this?
    Please give me suggestion.
    Many Thanks,
    Peter

  • Catchable Runtime Errors list (CATCH SYSTEM-EXCEPTIONS)?

    Hi All,
    I was just going through CATCH SYSTEM-EXCEPTIONS syntax. Could anyone give all the possible SAP existing Exceptions or kindly let me know how I can find in the system (4.6C) ?
    Thankss,
    Neeth

    Hi Vijay,
    Having read this post of yours, I couldn't help appreciating your modesty. And we hope to see much more active participation from your in this forum.
    By the way, you now have 50 points with just 22 posts. Now, can you keep up this ratio? Just try it. And you will know better
    Trying to pull your leg, anand mandalika.
    ========================================================
    And Nameeth,
    I really appreciate your coming back and rewarding the responses promptly. Please keep that up.
    Regards,
    Anand Mandalika.

  • Catch Runtime Exceptions under 46C

    Hello experts,
    My programme executes a dynamic open sql and the requirement is, my programme should never result in an ABAP short dump.
    With ABAP release 610, I can catch class based exceptions like cx_sy_dynamic_osql_error, but under 46C, I can only use CATCH SYSTEM-EXCEPTIONS, but no sql exceptions can be found in the runtime error list, that means no sql exceptions are perceived as catchable runtime errors.
    Therefore, could you advise how I should handle the runtime exceptions and not cause the ABAP short dump, please?
    Thanks and best regards,
    James

    http://help.sap.com/saphelp_nw04/helpdata/en/a9/b8eef8fe9411d4b2ee0050dadfb92b/content.htm
    will TRY and the CATCH statement be of any use ?

  • Centralized way of catching unexpected Exceptions in Java?

    Hi Guys,
    Is there a centralized way to catch unexpected Exceptions in Java?
    Here's an example:
    public static void main(String[] args)
        try
          new Thread()
         public void run()
           String s = null;
              //NullPointerException is thrown here
           s.indexOf(12);
          }.start();
        catch (Exception ex)
          System.err.println("This is not called");
          ex.printStackTrace();
      }Think about a program error, that the program is not prepared for, i.e. NullPointerException or an ArrayIndexOutOfBounds exception.
    What I'm after is not like "put critical block in try-catch", but something like registering a global ExceptionListener in java.lang.Runtime, a monitoring MBean or something that I could use in my program to do a simple exception logging.
    Any idea, help would be greatly appreciated!
    peter

    NullPointerException , IOException ....all are subclasses of the base class Exception, so catch(Exception) will catch any exception in the current thread. So modify ur code a bit
    public static void main(String[] args)
          new Thread()
         public void run()
           try{
           String s = null;
              //NullPointerException is thrown here
           s.indexOf(12);
    catch (Exception ex)
          System.err.println("This is not called");
          ex.printStackTrace();
          }.start();
    .....

  • Catching RFC exception and "moving" it to soapenvlp:Fault.faultcode

    Hi,
    i have a simple SOAP2RFC (sync) interface. my question is:
    how can i catch an exception (thrown by RFC) and use it as soapenvlp:Fault.faultcode content?
    Regards
    Uri

    Hi!
    have a simple SOAP2RFC (sync) interface. my question is:
    how can i catch an exception (thrown by RFC) and use it as soapenvlp:Fault.faultcode content?
    Yes I think you can catch an exception by using RFC EXception (Fault) Message instead of RFC Response in the mappings. and remaining all steps are same.
    But that is mostly depends upon the RFC Function module that you are using and at which the logical coding of that Function module.
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/18dfe590-0201-0010-6b8b-d21dfa9929c9]
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40574601-ec97-2910-3cba-a0fdc10f4dce]
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/8c10aa90-0201-0010-98a0-f071394bc9ae]
    [http://help.sap.com/saphelp_nw70/helpdata/EN/44/2a41f420323f0ee10000000a114a6b/frameset.htm]
    [http://help.sap.com/saphelp_nw70/helpdata/EN/76/4a42f4f16d11d1ad15080009b0fb56/frameset.htm]
    Regards::
    Amar Srinivas Eli
    Edited by: Amar Srinivas Eli on Apr 8, 2009 8:44 PM

  • Can't catch the exception when transaction rollback ,BPEL/SOA 11G,updated!

    Hi Guys ,
    I have two insert/update invoke actions through dbadpter in my BPEL process .
    When I set the GetActiveUnitOfWork property of those two db adapters to true ,it successfully makes the global transaction work . any of them failed will cause the other rollback.
    But the CatchAll brunch can't catch the exception in that case,
    I can only see exception message from the system output :
    02/11/2009 11:36:46 AM oracle.toplink.transaction.AbstractSynchronizationListener beforeCompletion
    WARNING:
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.1.0) (Build 090527)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLIntegrityConstraintViolationException: ORA-00001: unique constraint (Table1_PK) violated
    from BPEL console , you can't even see the error , the process finished with no exception.
    When I set GetActiveUnitOfWork to false, CatchAll brunch is able to catch the exception , but global rollback is not working .
    I try all the other method like set the transaction property of BPEL to required , using checkpoint() in java embedding . it looks like only way is set GetActiveUnitOfWork to true, but can't catch exception.
    Here are some updated:
    Here is my process
    Main Sequence
    Invoke (dbadapter update)
    Invoke (dbadapter insert)
    Global CatchAll
    Invoke(jmsAdapter sendjms)
    if I disable the CatchAll branch , when insert failed , the insert will rollback as well, even GetActiveUnitOfWork set to false.
    enable CatchAll branch , even doing nothing in this branch , the update won't rollback when insert failed. it looks like when catch the exception , bpel seems not rollback , I try to add throw rollback in catchall branch, no any effect.
    any clue ?
    Kevin
    Edited by: kyi on Nov 5, 2009 10:10 AM

    Hi All,
    We are also facing a similar kind of issue.
    We have a simple BPEL which will makes use of JAva embedding to call an end point to check its availibility.
    The Java code for cheking the enpoint connectivity is below
    try{      
    boolean endpointAvailable = false;
    long start = System.currentTimeMillis();
    int endpointTestURL_port = 8445 ;
    int endpointTestURL_timeout = 500;
    String endpointTestURL_queryString = "" ;
    String endpointTestURL_protocol = (String)getVariableData ("endpointProtocol");
    addAuditTrailEntry("endpointTestURL_protocol: " + endpointTestURL_protocol);
    String endpointTestURL_host = (String)getVariableData ("endpointHost");
    addAuditTrailEntry("endpointTestURL_hostl: " + endpointTestURL_host);
    URL endpoint = new URL(endpointTestURL_protocol, endpointTestURL_host, 8445, endpointTestURL_queryString);
    addAuditTrailEntry("endpoint object is created" );
    String endpointTestURL = endpoint.toExternalForm();
    addAuditTrailEntry("Checking availability of endpoint at URL: " + endpointTestURL);
    // Configure connection
    HttpURLConnection connection = (HttpURLConnection)endpoint.openConnection();
    connection.setRequestMethod("GET");
    addAuditTrailEntry("The Method is Get");
    connection.setConnectTimeout(5000);
    addAuditTrailEntry("Timeout is 500 ms");
    // Open connection
    connection.connect();
    addAuditTrailEntry("Open Connection");
    String responseMessage = connection.getResponseMessage();
    addAuditTrailEntry("Recieved availability response from endpoint as: " + responseMessage);
    // Close connection
    connection.disconnect();
    endpointAvailable = true;
    if (endpointAvailable)
    setVariableData("crmIsAvailable", "true");
    else
    setVariableData("crmIsAvailable", "false");
    catch(Exception e)
    System.out.println ("Error in checking endpoint availability " + e) ;
    addAuditTrailEntry("error message is : " +e);         
    When we run the above as a seperate java program it runs fine i.e goes to the catch block and catches the exception.
    But when we run it within the java embedding in BPEL(11G) it gives us the follwoing error.
    The reason was The execution of this instance "490001" for process "default/GMDSSalesLeadsBackMediationInterface!1.0*soa_e1a6362f-c148-417c-819c-9327017ebfa4" is supposed to be in an active jta transaction, the current transaction status is "ROLLEDBACK" .
    Consult the system administrator regarding this error.
         at com.oracle.bpel.client.util.TransactionUtils.throwExceptionIfTxnNotActive(TransactionUtils.java:119)
         at com.collaxa.cube.engine.CubeEngine.store(CubeEngine.java:4055)
         at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:4372)
         at com.collaxa.cube.engine.CubeEngine.endRequest(CubeEngine.java:4281)
         at com.collaxa.cube.engine.CubeEngine._createAndInvoke(CubeEngine.java:713)
         at com.collaxa.cube.engine.CubeEngine.createAndInvoke(CubeEngine.java:545)
         at com.collaxa.cube.engine.delivery.DeliveryService.handleInvoke(DeliveryService.java:654)
         at com.collaxa.cube.engine.ejb.impl.CubeDeliveryBean.handleInvoke(CubeDeliveryBean.java:355)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
         at com.bea.core.repackaged.springframework.jee.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:104)
         at oracle.security.jps.ee.ejb.JpsAbsInterceptor$1.run(JpsAbsInterceptor.java:88)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:414)
         at oracle.security.jps.wls.JpsWeblogicEjbInterceptor.runJaasMode(JpsWeblogicEjbInterceptor.java:61)
         at oracle.security.jps.ee.ejb.JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:106)
         at oracle.security.jps.ee.ejb.JpsInterceptor.intercept(JpsInterceptor.java:106)
         at sun.reflect.GeneratedMethodAccessor960.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
         at com.bea.core.repackaged.springframework.jee.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:69)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
         at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
         at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
         at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
         at weblogic.ejb.container.injection.EnvironmentInte
    we also get
    BEA1-108EA2A88DAF381957FF
    weblogic.transaction.internal.TimedOutException: Transaction timed out after 301 seconds
    BEA1-108EA2A88DAF381957FF
         at weblogic.transaction.internal.ServerTransactionImpl.wakeUp(ServerTransactionImpl.java:1733)
         at weblogic.transaction.internal.ServerTransactionManagerImpl.processTimedOutTransactions(ServerTransactionManagerImpl.java:1578)
         at weblogic.transaction.internal.TransactionManagerImpl.wakeUp(TransactionManagerImpl.java:1900)
         at weblogic.transaction.internal.ServerTransactionManagerImpl.wakeUp(ServerTransactionManagerImpl.java:1488)
         at weblogic.transaction.internal.WLSTimer.timerExpired(WLSTimer.java:35)
         at weblogic.timers.internal.TimerImpl.run(TimerImpl.java:273)
         at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    javax.ejb.EJBException: Transaction Rolledback.: weblogic.transaction.internal.TimedOutException: Transaction timed out after 301 seconds
    BEA1-108EA2A88DAF381957FF
    We tried the following
    Increase the JTA timeout in the EM console to a larger value like 600 secs.
    The BPEL instance is not getting created.
    Any help would be appreciated
    Thanks
    Lalit

  • Catching Runtime Exception

    Is it good practice to catch High level Exception in the try block, this would also catch RuntimeException. My personal opinion is not to catch the Runtime Exception and let the JVM handle it. However if there is a need to catch specific Runtime Exception, code should be written for that.
    try
    // Your code
    catch (Exception e)
    e.printStackTrace()
    }

    I agree that runtime exceptions should generally not
    be caught as they are mistakes of programmers.
    But in order to debug a large project with hundreds of
    classes it can be useful to do that anyways.
    Any my big question is: how?
    I tried to wrap the content of the main method in a
    try / catch block hoping that I could catch all
    exceptions not handled somewhere else.
    But it didn't work.
    I manually threw some exceptions somewhere in my GUI
    and the main method wrapper didn't get them.
    But the VM did and printed the exception message.
    But I didn't want the VM to catch my exceptions. I
    wanted to catch them myself at the lowest possible
    point in my own classes.
    And I thought that was the main method.
    Can anyone help me?
    Thank you
    Matthias Klein
    P.S. please excuse my improvable english; it's not my
    mother tongue.AWT uses many different threads in your program that you never find out about unless something breaks. main(String arg[]) starts as the lowest possible point but, if you construct a Frame, Image, or certain other objects from the AWT package, AWT Threads automatically start over which you have little or no control.
    Overall, I don't think it's actually possible to catch the Runtime Exceptions out of these Threads. The best this you can do about them is prevent them from happening.

  • Using cal.setlenient(false) - won't catch my exception

    I've read through a lot of the posts, but nothing seems to work. Basically I'm writing a JUnit test for one of my classes and I'm trying to test one of my constructors' exceptions, but it won't catch the exception! Please take a look:
    This is part of my original class.
    public YearMonthDay(int year, int month, int day)
    // Instantiate a calendar to let it validate our date.
    try
    Calendar cal = Calendar.getInstance();
    cal.setLenient(false);
    cal.clear();
    // Set Calendar values to passed in parameters
    cal.set(Calendar.YEAR, year);
    cal.set(Calendar.MONTH, month - 1);
    cal.set(Calendar.DAY_OF_MONTH, day);
    //System.out.println("cal: " + cal.getTimeInMillis());
    catch (Exception e)
    //This is only here for testing current testing purposes
    System.out.println("Exception: " + e + " : " + month);
    throw new IllegalArgumentException("Invalid date parameters: " + year
    + ", " + month + ", " + day);
    this.year = year;
    this.month = month;
    this.day = day;
    This is part of my JUnit test where I'm sending "INVALID" dates to see if the exception will be caught.
    public void testExceptionValidCalendarDate()
    boolean caught = false;
    try
    YearMonthDay testInvalidDate = new YearMonthDay(2007, 15, 40);
    //System.out.println("testFalse :" + testFalse.toString());
    catch (IllegalArgumentException e)
    caught = true;
    assertTrue("testExceptionValidCalendarDate, did not get IllegalArgumentException", caught);
    I did read somewhere that the set() command only sets the fields, it doesn't do much checking, its not till you call something like "get()" that throws an exception. For instance, notice the commented portion "System.out....,,cal.getTimeInMillies()." if you allow that to be run, it throws an error, but I need for this constructor to set fields based on passed in parameters AND throw an exception if Year, Month or Day is invalid! Please help.

    Crossposted:
    http://forum.java.sun.com/thread.jspa?threadID=5231209
    Don't reply here. Instead see the crosspost.

Maybe you are looking for

  • Trine 2 issues on Macbook Pro Retina

    Hi, I'm a new owner of a Macbook Pro Retina and not long after a bought the computer I decided to download and purchase Trine 2 from the app store.  I figured I would buy a game that could really utilize the high quality retina screen, however Trine

  • Has anyone else experienced Airplay audio dropping?

    Has anyone else experienced Airplay audio dropping while playing mp3s from MacBook Pro to Apple TV 2 and/or Airport Express g and/or n versions with an Airport Extreme N base? Using mp4 works fine but I've got some older files in mp3 that in between

  • Safari 4.1.1 and 4.1.2 problem

    Safari 4.1.1 stops loading some pages with only one item to go, and only on some websites. I recently updated to Safari 4.1.2 and it is worse. I am using airport extreme 7.4.2 wireless to access the internet. The pages that stop loading, always stop

  • How to import Class12.jar into Embeded OC4J Library of JDeveloper 10gR3?

    Hi! To someone who can help this.... I try to use database connection tool in JDeveloper 10gR3 test jdbc driver for a remote site of Oracle server. Because of server site configuration, the thin driver might be forbiden from firewall, but oci driver

  • Does Adobe provide a free API for creating PDF files

    Does Adobe provide a free API (for Windows) for creating PDF files?   We are currently using a basic, internally developed API for creating PDF files, but would like some additional capabilities ... in particular the ability to add a watermark that a