Generic error/exception handler

Well guys, I think I got a challenge for you: I have been thinking for some time about the idea of having a generic error handler for my applications. It's one of these things you should just have: In large GUI apps you usually try to catch all exceptions and display some sort of nice error dialog telling the user what went wrong and what he has to do now. However, there are runtime errors that one can't foresee. These might be bugs, sure, but they happen, so there should be a way of dealing with them. For example, let's say there is a NullPointerException. The clean way would be to display a message box saying something like "Bug!" and giving the user the chance to save his work (or do that automatically). However, this does not seem to be possible. Sure, I could surround every method code with a try { ... }catch(Exception e) and display the dialog, but that seems rather tedious. Does anyone know a better way? Like a common error handling method that is always called when there is an uncaught exception. I dunno, but my IDE JBuilder has something like that, because it is able to stop at "all uncaught exceptions". Any suggestions?
Thanks guys, or do we have to file a RFE???
Filip Rindler

Well, that doesn't work for GUI apps as their main method is done after initializing and all other work is done by the event dispatch thread that is responsible for receiving OS messages (such as mouse motion / clicked / ...). Then this thread calls the event listener methods of registered listeners. It's actually a little more complex how AWT/Swing handles things, but that's the general concept and it is the core of the problem as well: I cannot change any of the event dispatch code (it's deep down in the AWT), so therefore I cannot catch any exceptions there. But maybe there's a hook...

Similar Messages

  • Error exception handling in adf

    hi how do i handle error exception in adf for exaple if i have validation/constraint in my database that no duplicate value must be entered in table. how can i display unique constraint error in more meangiful way so the user user can undestand it,am in jdeveloper 11.1.1.6.0
    how can i show this error to user as error message oppose to this database error,this error happen if same user is added to same organisation twice but the same user can be added to other organisation,i what to display error message like "this user already belong to organisation xyz"Edited by: adf009 on 2013/03/11 9:49 AM
    Edited by: adf009 on 2013/03/11 10:56 AM
    Edited by: adf009 on 2013/03/11 4:26 PM

    i change the method to this
           @Override
        public void reportException(DCBindingContainer dCBindingContainer,
                                    Exception ex) {
                if (ex instanceof TxnValException) {
                          Object[] exceptions= ((TxnValException)ex).getDetails();
                          if(ex!=null){
                          for(int i=0;i<exceptions.length;i++){
                              if(ex instanceof RowValException){
                                   this.reportException(dCBindingContainer, (Exception)ex);                                
                              else{
                            super.reportException(dCBindingContainer, (Exception)ex);
    but is still not display error message in more meangful way
    my DataBindings.cpx  is
    <?xml version="1.0" encoding="UTF-8" ?>
    <Application xmlns="http://xmlns.oracle.com/adfm/application"
                 version="11.1.1.61.92" id="DataBindings" SeparateXMLFiles="false"
                 Package="uam.view" ClientType="Generic"
                ErrorHandlerClass= "uam.view.CustomErrorHandler">
      <definitionFactories>
        <factory nameSpace="http://xmlns.oracle.com/adf/controller/binding"
                 className="oracle.adf.controller.internal.binding.TaskFlowBindingDefFactoryImpl"/>
        <dtfactory className="oracle.adf.controller.internal.dtrt.binding.BindingDTObjectFactory"/>
      </definitionFactories>
      <pageMap>
        <page path="/payment.jsff" usageId="uam_view_paymentPageDef"/>
        <page path="/test.jspx" usageId="uam_view_testPageDef"/>
        <page path="/security.jsff" usageId="uam_view_securityPageDef"/>
        <page path="/pdetails.jsff" usageId="uam_view_pdetailsPageDef"/>
        <page path="/odetails.jsff" usageId="uam_view_odetailsPageDef"/>
        <page path="/opayment.jsff" usageId="uam_view_opaymentPageDef"/>
        <page path="/members.jsff" usageId="uam_view_membersPageDef"/>
        <page path="/suburb.jsff" usageId="uam_view_suburbPageDef"/>
        <page path="/testsub.jspx" usageId="uam_view_testsubPageDef"/>
        <page path="/WEB-INF/register-org-flow.xml#register-org-flow@CreateInsert"
              usageId="uam_view_register_org_flow_register_org_flow_CreateInsertPageDef"/>
        <page path="/SelectOrg.jsff" usageId="uam_view_SelectOrgPageDef"/>
        <page path="/updateorg.jspx" usageId="uam_view_updateorgPageDef"/>
        <page path="/OrgDetails.jsff" usageId="uam_view_OrgDetailsPageDef"/>
      </pageMap>
      <pageDefinitionUsages>
        <page id="uam_view_paymentPageDef" path="uam.view.pageDefs.paymentPageDef"/>
        <page id="uam_view_testPageDef" path="uam.view.pageDefs.testPageDef"/>
        <page id="uam_view_securityPageDef"
              path="uam.view.pageDefs.securityPageDef"/>
        <page id="uam_view_pdetailsPageDef"
              path="uam.view.pageDefs.pdetailsPageDef"/>
        <page id="uam_view_odetailsPageDef"
              path="uam.view.pageDefs.odetailsPageDef"/>
        <page id="uam_view_opaymentPageDef"
              path="uam.view.pageDefs.opaymentPageDef"/>
        <page id="uam_view_membersPageDef" path="uam.view.pageDefs.membersPageDef"/>
        <page id="uam_view_suburbPageDef" path="uam.view.pageDefs.suburbPageDef"/>
        <page id="uam_view_testsubPageDef" path="uam.view.pageDefs.testsubPageDef"/>
        <page id="uam_view_register_org_flow_register_org_flow_CreateInsertPageDef"
              path="uam.view.pageDefs.register_org_flow_register_org_flow_CreateInsertPageDef"/>
        <page id="uam_view_SelectOrgPageDef"
              path="uam.view.pageDefs.SelectOrgPageDef"/>
        <page id="uam_view_updateorgPageDef"
              path="uam.view.pageDefs.updateorgPageDef"/>
        <page id="uam_view_OrgDetailsPageDef"
              path="uam.view.pageDefs.OrgDetailsPageDef"/>
      </pageDefinitionUsages>
      <dataControlUsages>
        <dc id="OrgValidationBean" path="uam.view.OrgValidationBean"/>
        <dc id="UAMUtil" path="uam.view.UAMUtil"/>
        <BC4JDataControl id="UAMAppModuleDataControl1"
                         Package=uam.model.common"
                         FactoryClass="oracle.adf.model.bc4j.DataControlFactoryImpl"
                         SupportsTransactions="true" SupportsFindMode="true"
                         SupportsRangesize="true" SupportsResetState="true"
                         SupportsSortCollection="true"
                         Configuration="UAMAppModuleLocal" syncMode="Immediate"
                         xmlns="http://xmlns.oracle.com/adfm/datacontrol"/>
        <BC4JDataControl id="AppModuleDataControl"
                         Package=uam.model"
                         FactoryClass="oracle.adf.model.bc4j.DataControlFactoryImpl"
                         SupportsTransactions="true" SupportsFindMode="true"
                         SupportsRangesize="true" SupportsResetState="true"
                         SupportsSortCollection="true"
                         Configuration="AppModuleLocal" syncMode="Immediate"
                         xmlns="http://xmlns.oracle.com/adfm/datacontrol"/>
        <BC4JDataControl id="UpdAppModuleDataControl"
                         Package=uam.model.UpdOrgDetails"
                         FactoryClass="oracle.adf.model.bc4j.DataControlFactoryImpl"
                         SupportsTransactions="true" SupportsFindMode="true"
                         SupportsRangesize="true" SupportsResetState="true"
                         SupportsSortCollection="true"
                         Configuration="UpdAppModuleLocal" syncMode="Immediate"
                         xmlns="http://xmlns.oracle.com/adfm/datacontrol"/>
      </dataControlUsages>
    </Application>
    even if i call class CustomExceptionHandler it does not work
    {code}
    i have recreated the problem using hr schema and i uploaded hear
    http://www.datafilehost.com/download-9d37bd8a.html
    Edited by: adf009 on 2013/03/11 5:20 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error/Exception handling in MQSeries

    Hi,
    What is the robust (yet simple) way to handle any exception generated while doing any operation in MQ Series for e.g. putting messages on queue.
    Currently i have just done exception handling using try/catch blocks in my java application.
    Kindly explain.
    Thanks,
    Sahil

    This forum is specific to the Sun Java System Message Queue
    product and is not a forum on IBM's MQSeries product.
    If you have a question on MQSeries, you may want to look for a forum on IBM's site.

  • Error/Exception handling in PI (Inbound Proxy)

    Dear All,
    I need some help in PI Error handling.
    If PI sends data to an ABAP inbound proxy and an error occurs in PI because of type mismatch (e.g. Unable to convert date).
    This error is persistent in the PI monitor, but how do I let the Sender know that an error has occured?
    regards,
    Piyush

    Hi,
    I understand that you have a doubt, if PI sends data to ABAP inbound proxy and an alert reaised due to type mismatch. Now, you would like to know how to acknowledge that sender to know about the alert?
    First of all, get the payload and test in the message mapping, you will get know where exactly you got the error or check in the trace in Moni. You need to identify the issue and let the user know why exactly it failed.

  • Application Error :: Exception Handling

    Hi
    Workflow of my scenario is -->
    <b>SAP R/3 -- Sender RFC Adapter -- XI -- Rec. SOAP Adapter -- Web Service</b>
    In case we are sending correct information to WebService, we are getting results back to SAP R/3. But in case of an Application Error in  Web Service ( like wrong data value ), it is returning following payload as response -->
    <i><?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Adapter
      -->
      <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">vessptd01</ns1:hostname></i>
    So I created the XSD file for this payload & map it with my <i><RFC>.Exception</i> structure, folliwing is my Exception message mapping text preview -->
    <i>/ns1:Z_MAPINFO.Exception/Name=const([value=UNKNOWN ADDRESS]) /ns1:Z_MAPINFO.Exception/Text=/ns0:hostname= /ns1:Z_MAPINFO.Exception/Message=const([value=0]) /ns1:Z_MAPINFO.Exception/Message/ID=const([value=I]) /ns1:Z_MAPINFO.Exception/Message/Number=const([value=11]) /ns1:Z_MAPINFO.Exception/Attributes=const([value=1]) /ns1:Z_MAPINFO.Exception/Attributes/V1=/ns0:hostname=</i>
    Now when I executed the scenario, I can see in SXMB_MONI ( with Application Error as status ) that following RFC XML is going to SAP R/3 server -->
    <i><?xml version="1.0" encoding="UTF-8" ?>
    - <ns1:Z_MAPINFO.Exception xmlns:ns1="urn:sap-com:document:sap:rfc:functions">
      <Name>UNKNOWN ADDRESS</Name>
      <Text>vessptd01</Text>
    - <Message>
      <ID>I</ID>
      <Number>11</Number>
      </Message>
    - <Attributes>
      <V1>vessptd01</V1>
      </Attributes>
      </ns1:Z_MAPINFO.Exception></i>
    But still SAP R/3 is giving Short DUMP with the message as
               <b>Message type " " is unknown.</b>
    although ABAPers are trying to catch exception fields. Also one thing I noticed that when I imported the <RFC>.Exception structure in XI, I see field names like
    "<i>Name, Text, Message, ID, Number, Attributes, V1, V2, V3, V4</i> ".
    But in SAP R/3 RFC when ABAPers define Exception for RFC, they see following fields -->
    <i>MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.</i>
    Now I am not sure what is going wrong. Can you pls. suggest.
    - Lalit -

    Satish
    Our scenario is actually getting the Latitude & Longitude of given location from Web-Service, so when the address details are correct. SAP R/3 is getting populated with correct response i.e Latitude & Longitude.
    But in case when User is entering Wrong Address ( which does not exist ), we are getting following payload as response from Web-Service -->
    <i><?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Call Adapter
      -->
      <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">vessptd01</ns1:hostname></i>
    In which it is just returning the Host Name of server in which it is installed.
    I actually pasted the Text-Preview of my Exception Message Mapping also, do you see any error in that.
    I have no issues with Request & response Message Mapping.
    - lalit -

  • Generic error handler

    Im looking to implement a generic error/Exception handler centrally to this fairly large system.
    The error messages displayed to the user are also quite complex and will have to be created by the handler.
    If anyone has any ideas or can perhaps point me into the direction of a pattern etc it will be much appreciated.
    Thanks a million!!

    On a system I wrote previously, I used this.
    First, I have a series of classes that encapsulate user-readable messages.
    /** a message is a serialisable object.
    It's toString() method returns the text of a message
    suitable for being displayed to a user. */
    abstract class Message implements Serializable {}
    /** ToHtml tags an object as having a toHtml method. */
    interface ToHtml
      /** This method returns a string suitable for insertion into a
          JEditorPane with a content tyhpe of text/html, or for inclusion
          into a web page. */
      public String toHtml();
    class MessageList extends Message implements ToHtml {
    List messages = new ArrayList();
    void addMessage(Message msg) { ... }
    void addAllMessages(MessageList lst) { messages.addAll(lst.messages); }
    /** concatenate the messages into a list separated by line breaks. */
    String toString() {}
    /** concatenate the messages into a HTML UL list. Use the toHtml on each message
         that implements it. */
    String toHtml() {}
    /** a message that uses java.text.MessageFormat to format the params */
    class ParameterisedPlainMessage extends Message {
      java.text.MessageFormat pattern;
      Object[] arguments;
      String toString() { return pattern.format(arguments); }
    /** A message that includes both a plain-text format and an HTML format */
    class ParameterisedHtmlMessage extends ParametrisedPlainMessage implements toHtml {
      java.text.MessageFormat htmlPattern;
      String toHtml() { return htmlPattern.format(arguments); }
    }To create these message objects, I use a message factory:
    class MessageFactory {
       String pattern;
       String htmlPattern;
       MessageFactory(String message_key) {
         // get the message format for plain text
         // get the message format for html 
       MessageFactory(Class clazz, String message_key) {
          this(clazz.getName() + "." + message_key);
       Message create(Object[] args) {
         if(we have an html pattern) {
            return new ParameterisedHtmlMessage(pattern, htmlpattern, args);
         else {
            return new ParameterisedPlainMessage(pattern, args);
       Message create(Collection args)  { ... }
       Message create()  { ... }
       Message create(Object arg1)  { ... }
       Message create(Object arg1, Object arg2)  { ... }
       Message create(Object arg1, Object arg2, Object arg3)  { ... }
       Message create(Object arg1, Object arg2, Object arg3, Object arg4)  { ... }
       // etc etc
    }The text of the message formats will typically be in a resource bundle, some XML, or a properties
    file. The key of the message is usually a class or package name followed by an upper case
    identiier. If the message is only ever created in one particular class, then I use the class name,
    otherwise the name of the most reasonable package.
    Finally, the message formats end with an optional .plain or .html
    You use them like this:
    class Foo {
       private static final Message CANT_DO_THIS = new MessageFactory(Foo.class, "CANT_DO_THIS");
       private static final Message OK = new MessageFactory(Foo.class, "OK");
       Message bar(int because) {
         return because == 0 ? OK.create() : CANT_DO_THIS.create(new Integer(i));
    }with a properties file like this:
    quux.baz.Foo.CANT_DO_THIS.plain=Can't do this for a value of {0}.
    quux.baz.Foo.CANT_DO_THIS.html=<FONT color=\"red\">Can't do this</FONT> for a value of <B>{0}</B>.
    quux.baz.Foo.OK=All Ok.Now then. As to the question of exceptions.
    We have to distinguish between serious exceptions and exceptions that arise as part of normal processing. For instance, if one EJB gets a RemoteException when calling anoter, then this is
    serious. For these things, I use a class ContainerException which extends EJBException. EJBException is an unchecked exception, and always triggers a rollback of left uncaught.
    ContainerException has a constructor on it that takes a RemoteException (among others), and which
    spits out an WARNING level log line when it is constructed.
    For exceptions that arise as part of normal processing, I create a class BusinessException
    abstract class BusinessException extends Exception {}I have a concrete subclass of this:
    class MessageException extends BusinessException {
      Message msg;
      MessageException(Message msg) {}
      /** override getMessage */
      String etMessage() { return msg.toString(); }
      Message getMessageObject)( { return msg; }
    }If you want to catch specific business events, you can subclass this:
    class OutOfMoneyException {
      static MessageFactory OUT_OF_MONEY =
         new MessageFactory(OutOfMoneyException.class, "OUT_OF_MONEY");
       Person p;
      OutOfMoneyException(Person p) {
        super(OUT_OF_MONEY.create(p));
        this.p = p;
      Person getPerson() { return p; }
    }Or you can just build instances of MessageException without worring about subclassing them.
    class Account {
      static MessageFactory ACCOUNT_CLOSED =
         new MessageFactory(Account.class, "ACCOUNT_CLOSED");
      static MessageFactory ACCOUNT_LOCKED =
         new MessageFactory(Account.class, "ACCOUNT_LOCKED");
      void makeWithdrawal(int amt) throws BusinessException {
         if(account is closed)
         throw new MessageException(ACCOUNT_CLOSED.create(this));
         if(account is locked)
         throw new MessageException(ACCOUNT_LOCKED.create(this));
         if(coh < amt)
           throw new OutOfMoneyException(getPerson());
         coh -= amt;
    class DoSomeStuff {
      void doSomeStuff() throws BusinessException {
        boolean need_to_rollback = false;
        MessageList problems = new MessageList();
        for(wdl in withdrawal list) {
          try {
             wdl.getAccount().makeWithdrawal(wdl.getAmount());
          catch(OutOfMoneyException ex) {
            problems.add(ex.getMessageObject());
          catch(BusinessException ex) {
            // business exptions other than out of money mean
            // we must do a rollback.
            problems.add(ex.getMessageObject());
            need_to_rollback = true;
        if(need_to_rollback) transaction.rollBack();
        if(!problems.isEmpty()) throw new MessageException(problems); 
        // else, all ok.
    }And that about does it. You can then call popUpError(), which will use a JEditorPane to
    display the message in HTML to the user, so your messages may be as visually complex as you
    wish.

  • Generic Exception Handling

    Im trying to get a solution done on generic runtime exception handling.
    What kind of possibilities do i have to have a generic solution done in JSF, without forcing my
    Managed Beans to handle runtime exceptions.
    As JSF has different phases and each phase would be forced to catch those runtime exceptions,
    it seems to be difficult to me...
    The idea would be like:
    try{
    doRender()/doAction()/doValidate() etc ...
    }catch(Exception e){
    // do something and put a message to FacesContext
    Edited by: nailuenlue on Dec 4, 2008 11:23 AM

    Yeah! I know the difference between chacked ans uncheked exceptions, and how sprign work with exceptions. This is the reason for my comments and suggestions.
    I think you don`t understand me, and because hope is not enough I try to explain me (maybe help others):
    1.- <error-page> not only work with http errors headers as 404, you can specify a java exception including Exception
    2.- In a Servlet you can do wath you need as: send an email or a mobile message to Admin staff, redirect, forward, log or wathever you need. (I think is more than only show an error message).
    <error-page>
      <exception-type>java.lang.Exception</exception-type>
      <location>/yourServlet</location>
    </error-page>By the other hand I can tell you that JSF implement MVC, then JSF need a front controller (the C of MVC), you canf find it into web.xml descriptor, something like this:
    <servlet>
      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
      <servlet-name>Faces Servlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
    </servlet-mapping> Yeah! the controller is a servlet. you can try to extend this class and overwrite some methods.

  • Recommended Practice for Exception handling in JSP portlets

    Hi,
    This may be a redundant question, but hope to get some feedback on the generally used practice of catching exceptions in a JSP based Portal application.
    Is it okay to just make use of the standard JSP errorpage directive in each of the JSP portlets to point to the same errorpage.jsp. If a problem occurs in any of the portlets, the userfriendly message in the errorpage.jsp would be rendered.
    Of course there could be some kind of error logging done in the errorpage.jsp to track the error stack. This also means, that you would not want to catch any exceptions inside each of the portlet JSPs but rather let the errorpage directive, be the catch all?
    regards
    -Ananth

    Mohana,
    Pls ignore the voice mail,it was for something else and I was able to talk to Peter as well about this.
    Regarding the error/exception handling -
    If the errorPage.jsp is used in each of the JSP portlets with the help of the JPS errorPage directive, if a general system failure or major appln. error occurs, you will get the errorPage.jsp containing the user friendly message to show up in each of the half a dozen portlets on the page!!. Is that allright.
    You cannot really redirect the entire page using the code inside the JSP portlet. It will only render inside the same portlet. The only way you can do this is to use Javascript.
    -Ananth

  • Generic Exception handler in java

    We have developed a client java application with our own exception hierarchy derived from java.lang.exception. We raise our own exception in case of error scenarios. But there is one additional thing which we want to do:
    1. When ever any exception is raised in our exception we want to do some generic exception handling (like kicking of some module which collects the log files and send it to the administrator.
    2. We want the above activity to happen also when any runtime exception is raised. We are not catching any runtime exception and we have no handle for this.
    How should we go about this. Can we write a very low-level generic exception handler?
    We do not want to have done at every catch block we have in our code. I mean we want to have some hook at a very generic place.
    Let me know if some body can be help me on this.

    As far as I know, for exceptions that are caught, you must make a call to a generic handler in the catch block, or you may rethrow the exception as a RuntimeException, and let it propagate.
    For RuntimeExceptions and Errors in threads that you create, the easiest way to solve this is to subclass ThreadGroup, override uncaughtException with the appropriate code, and create all your threads in this group. For a thread like main, have the first thing in the thread be the creation of a new thread in the new group, then pass control to that thread. For fixed threads, like the event queue, someone had a suggestion already. Note that uncaughtException is only called just before the thread ends, so an exception that shouldn't end the thread should be handled seperately.

  • The handle is invalid error exception when screenshoot from screen why and how to solve

    Hi guys i have problem when i take screen shoot from screen it give me exception
    error the handle is invalid as following
    ee the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.
    ************** Exception Text **************
    System.ComponentModel.Win32Exception: The handle is invalid
       at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
       at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize)
       at Sales.Form1.timer4_Tick(Object sender, EventArgs e)
       at System.Windows.Forms.Timer.OnTick(EventArgs e)
       at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
    this is my code as following :
    under timer tick event problem happen in screen shoot
    the proplem in these lines
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    Graphics graphics = Graphics.FromImage(bitmap as Image);
    graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
    bitmap.Save("C:\\screenshot.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    if i put these lines under button event work ok
    but if i but these lines under timer make problem and give me exception above why
    this code of screenshoot work in my windows xp but when i put in windows server 2003 it give me error in screenshoot under timer event
    private void timer4_Tick(object sender, EventArgs e)
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    if (SalesClass1.IsStartValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123"))
    issent = 1;
    label7.Text = issent.ToString();
    else
    issent = 0;
    label7.Text = issent.ToString();
    if (Convert.ToInt32(label3.Text) > 0 && Convert.ToInt32(label2.Text) > Convert.ToInt32(label3.Text) &&Convert.ToInt32(label7.Text) == 0)
    Sales.SalesClass SalesClass2 = new Sales.SalesClass();
    SalesClass2.InsertShipment("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text));
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    Graphics graphics = Graphics.FromImage(bitmap as Image);
    graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
    bitmap.Save("C:\\screenshot.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    string smtpAddress = "smtp.mail.yahoo.com";
    int portNumber = 587;
    bool enableSSL = true;
    string emailFrom = "[email protected]";
    string password = "3444";
    string emailTo = "[email protected]";
    string subject = "Working Start"+label6.Text;
    string body =
    "Quantity Required" + "" + "(" + label2.Text + ")" + "/" +
    "Quantity Shipped" + "/" + "(" + label3.Text + ")" + "/" +
    "Quantity Remaining" + "/" + "(" + label4.Text + ")";
    using (MailMessage mail = new MailMessage())
    mail.From = new MailAddress(emailFrom);
    mail.To.Add(emailTo);
    mail.Subject = subject;
    mail.Body = body;
    mail.IsBodyHtml = true;
    mail.Attachments.Add(new Attachment("c:\\screenshot.jpeg"));
    System.Net.Mail.SmtpClient shggmtp = new SmtpClient(smtpAddress, portNumber);
    smtp.Credentials = new NetworkCredential(emailFrom, password);
    smtp.EnableSsl = enableSSL;
    smtp.Send(mail);

    Thank you for reply
    timer3 tick event and enabled to maximize the form if minimized
    this is all my code as following
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Net.Mail;
    using System.Net;
    using System.IO;
    using System.Data.SqlTypes;
    using System.Data.SqlClient;
    using System.Runtime.InteropServices;
    using System.Diagnostics;
    using Microsoft.Win32;
    namespace Sales
    public partial class Form1 : Form
    RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
    public int issent;
    public int isfinish;
    public Form1()
    reg.SetValue("Sales", Application.ExecutablePath.ToString());
    InitializeComponent();
    private const int SW_HIDE = 0;
    private const int SW_SHOWNORMAL = 1;
    private const int SW_SHOWMINIMIZED = 2;
    private const int SW_SHOWMAXIMIZED = 3;
    private const int SW_SHOWNOACTIVATE = 4;
    private const int SW_RESTORE = 9;
    private const int SW_SHOWDEFAULT = 10;
    [DllImport("user32.dll")]
    private static extern int ShowWindow(int hwnd, int nCmdShow);
    private void Form1_Load(object sender, EventArgs e)
    label8.Visible = false;
    label9.Visible = false;
    label10.Visible = false;
    label2.Visible = false;
    label3.Visible = false;
    label7.Visible = false;
    label8.Visible = false;
    label1.Visible = false;
    label2.Visible = false;
    label3.Visible = false;
    label4.Visible = false;
    Sales.SalesClass SalesClass4 = new Sales.SalesClass();
    string EndQuantity = SalesClass4.MaxEndQuantity("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    string TotalQuantity = SalesClass4.MaxTotalQuantity("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    label9.Text = EndQuantity;
    label10.Text = TotalQuantity;
    if (SalesClass4.IsStartValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123"))
    issent = 1;
    label7.Text = issent.ToString();
    else
    issent = 0;
    label7.Text = issent.ToString();
    label6.Text = DateTime.Now.ToString("dd/MM/yyyy");
    timer1.Start();
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    DataTable dt = SalesClass1.ShowSalesData("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    label1.Visible = false;
    dataGridView1.DataSource = dt;
    dataGridView1[0, dataGridView1.Rows.Count - 1].Value = "Total Sum";
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].Style.BackColor = Color.Yellow;
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Style.ForeColor = Color.Red;
    dataGridView1.Refresh();
    Sales.SalesClass SalesClass5 = new Sales.SalesClass();
    if (SalesClass5.IsFinishValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text)))
    isfinish = 1;
    label8.Text = isfinish.ToString();
    else
    isfinish = 0;
    label8.Text = isfinish.ToString();
    label11.Text = SalesClass5.MaxID1("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    private void timer1_Tick(object sender, EventArgs e)
    label6.Text = DateTime.Now.ToString("dd/MM/yyyy");
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    DataTable dt = SalesClass1.ShowSalesData("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    label1.Visible = false;
    dataGridView1.DataSource = dt;
    dataGridView1[0, dataGridView1.Rows.Count - 1].Value = "Total Sum";
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].Style.BackColor = Color.Yellow;
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Style.ForeColor = Color.Red;
    dataGridView1.Refresh();
    private void dataGridView1_DataSourceChanged(object sender, EventArgs e)
    double Total = 0;
    double Total1 = 0;
    double Total2 = 0;
    for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
    Total += Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value);
    Total1 += Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value);
    Total2 += Convert.ToDouble(dataGridView1.Rows[i].Cells[8].Value);
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[6].Value = Total;
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[7].Value = Total1;
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[8].Value = Total2;
    label2.Text = Total.ToString();
    label3.Text = Total1.ToString();
    label4.Text = Total2.ToString();
    private void timer2_Tick(object sender, EventArgs e)
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    string ID = SalesClass1.MaxID("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    string EndQuantity = SalesClass1.MaxEndQuantity("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    string TotalQuantity = SalesClass1.MaxTotalQuantity("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    label9.Text = EndQuantity;
    label10.Text = TotalQuantity;
    label11.Text = ID;
    if (SalesClass1.IsFinishValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text)))
    isfinish = 1;
    label8.Text = isfinish.ToString();
    else
    isfinish = 0;
    label8.Text = isfinish.ToString();
    if (Convert.ToInt32(label2.Text) == Convert.ToInt32(label3.Text) && Convert.ToInt32(label8.Text) == 0 && Convert.ToInt32(label2.Text) > 0 && Convert.ToInt32(label3.Text) > 0)
    Sales.SalesClass SalesClass2 = new Sales.SalesClass();
    SalesClass2.InsertLastShipment("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text), Convert.ToInt32(label11.Text));
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
    Graphics graphics = Graphics.FromImage(bitmap as Image);
    graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y,
    0, 0, Screen.PrimaryScreen.Bounds.Size,System.Drawing.CopyPixelOperation.SourceCopy);
    bitmap.Save("C:\\screenshot.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    string smtpAddress = "smtp.mail.yahoo.com";
    int portNumber = 587;
    bool enableSSL = true;
    string emailFrom = "[email protected]";
    string password = "2234";
    string emailTo = "[email protected]";
    string subject = "Working Finish" + label6.Text;
    string body = "Summary for Date" + "" + label6.Text + "" +
    "Quantity Required" + "" + "(" + label2.Text + ")" + "/" +
    "Quantity Shipped" + "/" + "(" + label3.Text + ")" + "/" +
    "Quantity Remaining" + "/" + "(" + label4.Text + ")";
    using (MailMessage mail = new MailMessage())
    mail.From = new MailAddress(emailFrom);
    mail.To.Add(emailTo);
    mail.Subject = subject;
    mail.Body = body;
    mail.IsBodyHtml = true;
    mail.Attachments.Add(new Attachment("C:\\temp2.gif"));
    System.Net.Mail.SmtpClient smtp = new SmtpClient(smtpAddress, portNumber);
    smtp.Credentials = new NetworkCredential(emailFrom, password);
    smtp.EnableSsl = enableSSL;
    smtp.Send(mail);
    private void timer3_Tick(object sender, EventArgs e)
    int hWnd;
    Process[] processRunning = Process.GetProcesses();
    foreach (Process pr in processRunning)
    if (pr.ProcessName == "Sales.vshost")
    hWnd = pr.MainWindowHandle.ToInt32();
    ShowWindow(hWnd, SW_SHOWMAXIMIZED);
    private void timer4_Tick(object sender, EventArgs e)
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    if (SalesClass1.IsStartValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123"))
    issent = 1;
    label7.Text = issent.ToString();
    else
    issent = 0;
    label7.Text = issent.ToString();
    if (Convert.ToInt32(label3.Text) > 0 && Convert.ToInt32(label2.Text) > Convert.ToInt32(label3.Text) && Convert.ToInt32(label7.Text) == 0)
    Sales.SalesClass SalesClass2 = new Sales.SalesClass();
    SalesClass2.InsertShipment("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text));
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
    Graphics graphics = Graphics.FromImage(bitmap as Image);
    graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y,
    0, 0, Screen.PrimaryScreen.Bounds.Size,System.Drawing.CopyPixelOperation.SourceCopy);
    bitmap.Save("C:\\screenshot.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    string smtpAddress = "smtp.mail.yahoo.com";
    int portNumber = 587;
    bool enableSSL = true;
    string emailFrom = "[email protected]";
    string password = "2234";
    string emailTo = "[email protected]";
    string subject = "Working Start" + label6.Text;
    string body =
    "Quantity Required" + "" + "(" + label2.Text + ")" + "/" +
    "Quantity Shipped" + "/" + "(" + label3.Text + ")" + "/" +
    "Quantity Remaining" + "/" + "(" + label4.Text + ")";
    using (MailMessage mail = new MailMessage())
    mail.From = new MailAddress(emailFrom);
    mail.To.Add(emailTo);
    mail.Subject = subject;
    mail.Body = body;
    mail.IsBodyHtml = true;
    mail.Attachments.Add(new Attachment("c:\\screenshot.jpeg"));
    System.Net.Mail.SmtpClient smtp = new SmtpClient(smtpAddress, portNumber);
    smtp.Credentials = new NetworkCredential(emailFrom, password);
    smtp.EnableSsl = enableSSL;
    smtp.Send(mail);
    private void timer5_Tick(object sender, EventArgs e)
    if (Convert.ToInt32(label3.Text) == 0 && Convert.ToInt32(label4.Text) == 0)
    Sales.SalesClass SalesClass2 = new Sales.SalesClass();
    SalesClass2.DeleteProcesses("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");

  • Generic Exception Handler/Listener

    All,
    I have a web application and I want to create a generic exception handler/listener which will listen to all the exception(checked and runtime) which are thrown by web application.
    Any idea how can I do this?
    Regards.

    797836 wrote:
    Hi,
    I want to build a generic exception handler which can be reused in any java j2ee applications. Unlikely. Probably impossible.
    I have java application which is communicating with other 3rd party applications like webservices, webmethods , etc from where we are getting an errorcode which will be used in our java application to do a lookup to get the respestive error message from the resource bundle. Please clarify in such case how I can go with a generic exception handler which will be build separately and will be integrated with Java applications to handle the exceptions and errors.An excellent example of why a universal exception handler wouldn't work.
    At some point a call tree looks like A->B->C, where C (or beyond) that is where your communications problem occurs. The impact of that depends on the application.
    For example if a user types in a url (at A) and the server (C) fails to resolve it then that is a user problem.
    However if nightly batch process expects to download an update file every night from one location and it can't connect then that is an operations error (or notification/alert.)

  • How to display the 500-internal server error on the Exception Handler page

    Hello
    My situation is as follows : JDev 11.1.1.0.2, ADF fusion application, one unbounded task flow containing 2 view pages view1.jspx and error.jspx
    The error jspx is marked as the exception handler.
    When an error occurs (typically a 500-Internal Server Error) the error.jspx is correctly displayed and shows our message such as 'Don't panic, please call our tech support'
    What I would like to do is to display the actual error stack on this page along with our message.
    I've searched around and I can't find how to either get the error stack in a bean or what EL expression should be used to get the error stack.
    Can anybody help ?
    Best Regards
    Paul
    Switzerland

    The error will be the same, but the stack trace will be different, such as
    Error 500--Internal Server Error
    oracle.adf.controller.security.AuthorizationException: ADFC-0619: Echec de la vérification des autorisations : '/view1.jspx' 'VIEW'.
         at oracle.adf.controller.internal.security.AuthorizationEnforcer.handleFailure(AuthorizationEnforcer.java:145)
         at oracle.adf.controller.internal.security.AuthorizationEnforcer.checkPermission(AuthorizationEnforcer.java:124)
         at oracle.adfinternal.controller.state.ControllerState.initializeUrl(ControllerState.java:639)
         at oracle.adfinternal.controller.state.ControllerState.synchronizeStatePart2(ControllerState.java:449)
         at oracle.adfinternal.controller.application.SyncNavigationStateListener.afterPhase(SyncNavigationStateListener.java:44)
         at oracle.adfinternal.controller.lifecycle.ADFLifecycleImpl$PagePhaseListenerWrapper.afterPhase(ADFLifecycleImpl.java:529)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.internalDispatchAfterEvent(LifecycleImpl.java:118)
         at oracle.adfinternal.controller.lifecycle.LifecycleImpl.dispatchAfterPagePhaseEvent(LifecycleImpl.java:166)
         at oracle.adfinternal.controller.faces.lifecycle.ADFPhaseListener$PhaseInvokerImpl.dispatchAfterPagePhaseEvent
    What I would like is to display the above stack trace on the page marked as the exception handler....
    Regards
    Paul

  • How to create a generic error handling proxy?

    Hello,
    i have few services proxies.
    I want to create a generic error handling osb proxy which does only errorhandling.
    This proxy would be called by all my services.Now suppose my services proxies would throw any error,the control will pass to error handling block of proxy..from there i will call this generic errorhandling proxyusing a service callout or publish action.In this proxy i want to do all my error handling based on 'n' conditions.and i want to pass the message to the fault variable of services proxy..kindly suggest ways..*main challenge is passing the message to the fault variable of services proxy*

    Hi,
    For generic error handling framework or common error handling framework...create a bpel process which takes the error details payload and sends the inf/data as email to the particular receipients.
    create business process with bpel process and proxy using business service.so wen ever error occurs at stage or route or proxy level ..call error handler action in OSB.Assign error handler details to the bpel input payload.
    FOR EX:
    <soap-env:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <com:test>
    <com:ProcessInfo>testDetails</com:ProcessInfo>
    <com:BusinessProcessName>testprocess</com:BusinessProcessName>
    <com:BusinessProcessInstanceId>{fn-bea:uuid()}</com:BusinessProcessInstanceId>
    <com:BusinessProcessStep>ReqLayer</com:BusinessProcessStep>
    <com:ErrorCode>{string($fault/ctx:errorCode)}</com:ErrorCode>
    <com:ErrorType>Technical</com:ErrorType>
    <com:StatusCode>Error</com:StatusCode>
    <com:ImplementationCode>OSB</com:ImplementationCode>
    <com:ErrorDescription>{string($fault/ctx:reason)}</com:ErrorDescription>
    <com:ErrorDateTime>{fn:current-dateTime()}</com:ErrorDateTime>
    <com:Node>{string($fault/ctx:location/ctx:node)}</com:Node>
    <com:Path>{string($fault/ctx:location/ctx:path)}</com:Path>
    </com:test>
    </soap-env:Body>
    this assign the error details values to the bpel process.

  • Exception Handling in Web Center for UI related Errors not working.

    Hi Guys,
    I have implemented Error Handling in ADF Application with Custom Model Exception Handler ( which is "CustomExceptionHandler extends DCErrorHandlerImpl") to catch all Model Layer Exception and to customize those error messages.
    I have implemented Error Handling in ADF Application with Custom View Exception Handler ( which is "CustomViewErrorHandler extends oracle.adf.view.rich.context.ExceptionHandler";) to catch all View Layer Exception and to customize those error messages.
    The design for this is , in Model Custom Exception Handler i find the exception message in "public String getDisplayMessage(BindingContext bindingContext,Exception exception) " method and throw RuntimeException to pass this exception to Custom View Layer Exception , so that i can handle all the exception @ View Layer it self .
    In the View Layer Exception Handler i am navigating to specific error page using
    String contextPath = ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getContextPath();
    ExternalContext ectx = facesContext.getExternalContext();
    ectx.redirect.
    All these things absolutly working in ADF Application for all the exception ( Model , View ) and i am successfully navigating to error page.
    Problem  :
    When i implement the same thing in Webcenter Application ( Model Custom Exception Handler and View Custom Exception Handler), Model Part is working as expected , but View Custom Exception Handler is not all calling .
    i am assuming that ,this View Custom Exception Handler (CustomViewErrorHandler extends oracle.adf.view.rich.context.ExceptionHandler) works only for JSF Life cycle
    "Allows frameworks to intercept otherwise unhandled exceptions thrown during the JSF lifecycle. ExceptionHandlers can be registered by adding a service file with a class name at META-INF/services/oracle.adf.view.rich.context.ExceptionHandler." from http://jdevadf.oracle.com/adf-richclient-demo/docs/apidocs/oracle/adf/view/rich/context/ExceptionHandler.html";
    As Webcenter Portal uses ADF Life Cycle this Exception Handler is not calling , i am not sure.
    if any one has any idea please let me know .
    Thanks
    Annapareddy Srinivasrao
    Edited by: Srinivasrao Annapareddy on May 22, 2013 12:06 PM

    i used runtime exception along with the wdwsmodel exception

  • Reboot due to system error / Register dump from exception handler

    hi,
    I have a problem with Labview RT when using Reboot function.
    The RT target (desktop) reboot but there is a message : Reboot due to system error.  And if I reboot once again, the target become in safe mode.
    Now, If I look at the log I obtain the following message see more in the log attached!
    *** REGISTER DUMP FROM EXCEPTION HANDLER (code 0x80000003) ***
    I don't understand why there is this message.
    Anybody has an explaination?
    Attachments:
    Nouveau Document texte2.txt ‏6 KB

    julesjay a écrit:
    ok I didn't know that. I will wait for tomorrow.
    NI france is not very efficient about labview Real time problems. 
    There is one or two experts and there aren't easily reachable.
    So a lot of question I send stay with no answer.....
    That why I hope someone will be able to help me.
    Hi Julesjay,
    After i have see your log file and the problem, i think NI FRANCE are working on your request for all problems you have in your application.
    And i don't understand what you say that, because we have make test, we have send us informations for make different tests, and we are still working on your problem.
    I know the problem are not resolved, but we are working for resolve it quickly.
    I suggested you to contact the AE that are your service request for have more information.
    Best regards,
    Christophe S.
    FSE East of France І Certified LabVIEW Associate Developer І National Instruments France

Maybe you are looking for