Error handling in static block

Hello All,
I have the following code
static{
abc();
private static void abc() throws Exception{
how do I throw error in static block because if I write
static {
abc() throws Exception;
it gives error during compilation.
How do I handle it.
Sachin

This is my code ...
import java.io.FileInputStream;
import java.io.*;
import java.util.Properties;
* @author sachin
* This class is used setting the configurations
public class Config{
     static String files_incoming;
     static String files_outgoing;
     static{
          try {
               configurations();
          } catch (ICMSException e) {
               LoggerCitiUtil.debug("Error in static block");               
     public static void configurations() throws ICMSException{
          Properties prop = new Properties();
          try{
               Properties property = System.getProperties();
               String systemPath = property.getProperty("MAIN_BASE_PATH");
          prop.load(new FileInputStream( systemPath + "bin/scp.ini"));
          }catch(IOException e){                 
               LoggerCitiUtil.debug("File not loaded in Config class");               
          try{
files_incoming=prop.getProperty("files_incoming").trim();;
files_outgoing=prop.getProperty("files_outgoing").trim();;                                   
          }catch(Exception e){
               LoggerCitiUtil.debug("Error in Config class");
               e.printStackTrace();
In the static block I want to throw new ICMSException(e);
When I write this :
     static{
          try {
               configurations();
          } catch (ICMSException e) {
throw new ICMSException(e);
               LoggerCitiUtil.debug("Error in static block");               
But it gives unhandled Exception during compile time.
Can anyone help me out ?.

Similar Messages

  • Exception handling in static block

    How to handle and exception raised in static block, pls answer

    Yeah, you are right, but I was just quoting the example on how to use it.
    Now, come to your problem,
    1. Static blocks are executed first time, when a class is loaded, i.e. when first reference of class is made.
    2. So, handle the situation there.
    E.g.
    You have test class:
    public class Test {
         static{
              try{
                   String s = null;
                   File f = new File(s);
              }catch(Throwable ne)
                   System.out.println("Eror");
                   throw new RuntimeException(); // Or use Error depends on your implementation
         public static void abc(){
              System.out.println("Hello");
    Now,
    calling it from another class:
    public class Test1 {
         public static void main(String[] args) {
              try{
              Test.abc(); *// This is the first instance where class for Test will be load and hence the static block will be executed*
              }catch(Throwable th) // Or catch Error
                   th.printStackTrace(); // Do the handling
              System.out.println("Done");
    This is a standard practice. From static block, instead of throwing Error exception, use some of your inherited class from Error. (i.e. create a exception framework inside your application)
    Hope this explains my point.

  • Exception-handling in a block (integration process)

    Hi,
    I have created an error handling in a block, but I want to send the information of the exception from xi to our software clix that is connected to xi via jms adapter.
    Is it possible??
    I'm new in XI, so can you give my a detailed hint?
    Thanks for your reply.
    Regards
    Stefan

    hi,
    >>>but I want to send the information of the exception from
    yes and no:)
    you cannot send an error message (cause there's no way how to map it)
    but you can send a standard text like "error"
    how to do that?:
    inside the exception branch
    add a transformation step in which you define dummy
    transformation which only fills one line "error"
    to the target message
    then you can add a send step (remember you're still inside the exception branch) and send this error message...
    Regards,
    michal

  • Can error handling framework use fault policies and BPEL catch blocks

    As part of an integrated customer solution that makes substantial use of SOA Suite (including OSB, BPEL, Mediator, etc) we are in the process of designing an “Error Hospital” subsystem to expose a web service API specifically for BPEL services and/or the OSB layer to call whenever they encounter an exception which they cannot handle so that the appropriate user is notified of the error (via email) and the error is recorded (in an appropriate common fault format, with error codes elaborated into more meaningful descriptions, etc) within OEM, immediately prior to returning the exception to the caller.
    The problem we have experienced in our design is as follows:
    •     We have an error handling service to be called, inside the BPEL catch blocks, when an error occurs to notify the appropriate user, via email, that an error has occurred;
    •     We also use the error handling XML fault-policies so that we can recover from an error using OEM (via human intervention);
    •     The error service needs to be called before the process is suspended (waiting for human intervention) so the email notification and error message formatting occurs BEFORE the recovery action. Unfortunately the fault policies trigger BEFORE the error handler is able to transform the error into the appropriate format and notify the user so the error recorded is not the reformatted one and the user is never notified.
    The key question is how can a BPEL, upon catching an exception, invoke the error handling service and AFTER that send the error to OEM (and have the process suspended).
    It seems the two mechanisms "cannot play nicely together"

    As part of an integrated customer solution that makes substantial use of SOA Suite (including OSB, BPEL, Mediator, etc) we are in the process of designing an “Error Hospital” subsystem to expose a web service API specifically for BPEL services and/or the OSB layer to call whenever they encounter an exception which they cannot handle so that the appropriate user is notified of the error (via email) and the error is recorded (in an appropriate common fault format, with error codes elaborated into more meaningful descriptions, etc) within OEM, immediately prior to returning the exception to the caller.
    The problem we have experienced in our design is as follows:
    •     We have an error handling service to be called, inside the BPEL catch blocks, when an error occurs to notify the appropriate user, via email, that an error has occurred;
    •     We also use the error handling XML fault-policies so that we can recover from an error using OEM (via human intervention);
    •     The error service needs to be called before the process is suspended (waiting for human intervention) so the email notification and error message formatting occurs BEFORE the recovery action. Unfortunately the fault policies trigger BEFORE the error handler is able to transform the error into the appropriate format and notify the user so the error recorded is not the reformatted one and the user is never notified.
    The key question is how can a BPEL, upon catching an exception, invoke the error handling service and AFTER that send the error to OEM (and have the process suspended).
    It seems the two mechanisms "cannot play nicely together"

  • Error 'Handling unit was not blocked - action cancelled' for Packing

    Hi Friends
    I am trying to execute Functional Module  HU_PACKING_AND_UNPACKING  to Pack Sales Order Line Items in to HU.
    But System is throwing unusual error Handling unit was not blocked - action cancelled
    The Other SAP SDN thread advised to implement  OSS Note 370195 , 331715.
    The Input Code given in the Note  370195 SAP Developer can not find in our system.
    SAP Note 331715 already implemented in our system.
    Please help to resolve the issue for Packing Sales Order Line Items in to HU.
    Thanks
    SR

    Refer OSS Note 370195 , 331715

  • How to perform Error Handling in this Bdc Code

    Hi,
    I had created this BDC for the tcode MB1B and i want to know how to perform the ERROR HANDLING in it ..
    Plzz provide me guidelines for doing it . here's d code:-
    report ZBDC_MB1B
           no standard page heading line-size 255.
    include bdcrecx1.
    data: begin of record OCCURS 0,
          WERKS_001(004),     "Plant
          MATNR_002(018),     "ItemId
          ERFMG_003(013),     "Quantity in Unit of Entry
          ERFME_004(003),     "Unit of Entry
          LGORT_005(004),     "Storage Location
          CHARG_006(010),     "BatchId
          KDAUF_007(010),     "Sales Order Number
          KDPOS_008(006),     "Item Number in Sales Order
          end of record.
    PARAMETERS : P_FILNAM LIKE RLGRAP-FILENAME.
      initialization.
      CTUMODE = 'A'.
      CUPDATE = 'A'.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILNAM.
      CALL FUNCTION 'WS_FILENAME_GET'
       EXPORTING
         MASK                   = ',. '
         MODE                   = 'O'
         IMPORTING
         FILENAME                 = P_FILNAM
       EXCEPTIONS
         INV_WINSYS             = 1
         NO_BATCH               = 2
         SELECTION_CANCEL       = 3
         SELECTION_ERROR        = 4
         OTHERS                 = 5
      IF SY-SUBRC <> 0.
            MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    start-of-selection.
    CALL FUNCTION 'WS_UPLOAD'
       EXPORTING
         FILENAME                      = P_FILNAM
         FILETYPE                      = 'DAT'
        TABLES
          DATA_TAB                     = RECORD
       EXCEPTIONS
         CONVERSION_ERROR              = 1
         FILE_OPEN_ERROR               = 2
         FILE_READ_ERROR               = 3
         INVALID_TYPE                  = 4
         NO_BATCH                      = 5
         UNKNOWN_ERROR                 = 6
         INVALID_TABLE_WIDTH           = 7
         GUI_REFUSE_FILETRANSFER       = 8
         CUSTOMER_ERROR                = 9
         NO_AUTHORITY                  = 10
         OTHERS                        = 11
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT RECORD.
      BEGIN OF SCREEN 1
    perform bdc_dynpro      using 'SAPMM07M' '0400'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'RM07M-SOBKZ'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    *perform bdc_field       using 'MKPF-BLDAT'
                                 '22.12.2008'.
    *perform bdc_field       using 'MKPF-BUDAT'
                                 '22.12.2008'.
    perform bdc_field       using 'RM07M-BWARTWA'
                                  '411'.
    perform bdc_field       using 'RM07M-SOBKZ'
                                  'E'.
    perform bdc_field       using 'RM07M-WERKS'
                                  RECORD-WERKS_001.             "Plant
    perform bdc_field       using 'XFULL'
                                  'X'.
    perform bdc_field       using 'RM07M-WVERS2'
                                  'X'.
      BEGIN OF SCREEN 2
    perform bdc_dynpro      using 'SAPMM07M' '0421'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSEG-CHARG(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '/00'.
    perform bdc_field       using 'MSEG-MATNR(01)'
                                  RECORD-MATNR_002.             "ITEMID
    perform bdc_field       using 'MSEG-ERFMG(01)'
                                  RECORD-ERFMG_003.             "QTY.
    perform bdc_field       using 'MSEG-ERFME(01)'
                                  RECORD-ERFME_004.             "UOM
    perform bdc_field       using 'MSEG-LGORT(01)'
                                  RECORD-LGORT_005.             "ST.LOC
    perform bdc_field       using 'MSEG-CHARG(01)'
                                  RECORD-CHARG_006.             "BATCHID
    perform bdc_field       using 'MSEGK-MAT_KDAUF'
                                  RECORD-KDAUF_007.             "S.O.
    perform bdc_field       using 'MSEGK-MAT_KDPOS'
                                  RECORD-KDPOS_008.             "S.O.LINE ITEM
    perform bdc_field       using 'DKACB-FMORE'
                                  'X'.
      BEGIN OF SCREEN 3
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_field       using 'DKACB-FMORE'
                                  'X'.
    perform bdc_dynpro      using 'SAPLKACB' '0002'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=ENTE'.
    perform bdc_dynpro      using 'SAPMM07M' '0421'.
    perform bdc_field       using 'BDC_CURSOR'
                                  'MSEG-ERFMG(01)'.
    perform bdc_field       using 'BDC_OKCODE'
                                  '=BU'.
    perform bdc_field       using 'DKACB-FMORE'
                                  'X'.
      BEGIN OF SCREEN 4
    perform bdc_dynpro      using   'SAPLKACB' '0002'.
    perform bdc_field       using      'BDC_OKCODE'
                                                '=ENTE'.
    perform bdc_transaction using 'MB1B'.
    ENDLOOP.

    hi,
    check this code in bold letters.
    INCLUDE BDCRECX1.
    TABLES : MARC.
    TYPES : BEGIN OF TY_UPLOAD,
            MATNR TYPE MARA-MATNR,
            WERKS TYPE MARC-WERKS,
            STEUC TYPE MARC-STEUC,
            END OF TY_UPLOAD.
    TYPES : BEGIN OF TY_MARC,
            MATNR TYPE MARA-MATNR,
            WERKS TYPE MARC-WERKS,
            END OF TY_MARC.
    TYPES : BEGIN OF TY_MTART,
            MATNR TYPE MARA-MATNR,
            MTART TYPE MARA-MTART,
            END OF TY_MTART.
    DATA : T_MARC TYPE STANDARD TABLE OF TY_MARC,
         : T_UPLOAD TYPE STANDARD TABLE OF TY_UPLOAD,
         : T_BASIC TYPE STANDARD TABLE OF TY_UPLOAD,
         : T_SALES TYPE STANDARD TABLE OF TY_UPLOAD,
         : T_ERROR TYPE STANDARD TABLE OF TY_UPLOAD.
    DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
           IT_BDCDATA_VIEW LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
           IT_DATA(3200) OCCURS 0 WITH HEADER LINE,
           IT_FIELD(3200) OCCURS 0 WITH HEADER LINE,
           IT_BDCMSG TYPE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA GI_MSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
    DATA : CHAR1(500),
          CHAR2(500),
          CHAR3 TYPE STRING,
          V_SELECTION TYPE STRING.  " For View Selection
    DATA : W_MARC TYPE TY_MARC,
           WA_UPLOAD TYPE TY_UPLOAD,
           WA_BASIC TYPE TY_UPLOAD,
           WA_SALES TYPE TY_UPLOAD,
           WA_ERROR TYPE TY_UPLOAD,
           WA_MTART TYPE TY_MTART.
    DATA : VAR TYPE N,
           VAR1 TYPE STRING.
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.   "SELECTION SCREEN
    PARAMETERS: P_FNAM LIKE RLGRAP-FILENAME.
    PARAMETERS: P_BAS LIKE RLGRAP-FILENAME.
    PARAMETERS: P_SAL LIKE RLGRAP-FILENAME.
    PARAMETERS: P_ERR LIKE RLGRAP-FILENAME.
    SELECTION-SCREEN : END OF BLOCK B1.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAM.
      PERFORM SEARCH USING P_FNAM.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BAS.
      PERFORM SEARCH USING P_BAS.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SAL.
      PERFORM SEARCH USING P_SAL.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_ERR.
      PERFORM SEARCH USING P_ERR.
    *&      Form  SEARCH
          text
         -->PFNAME     text
    FORM SEARCH USING PFNAME.
      CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
        EXPORTING
          STATIC    = 'X'
        CHANGING
          FILE_NAME = PFNAME.
    ENDFORM.                    "SEARCH
    START-OF-SELECTION.
      PERFORM UPLOAD_PROCESS USING P_FNAM.
      PERFORM OPEN_GROUP.
      PERFORM PROCESS.
      PERFORM CLOSE_GROUP.
      IF NOT T_BASIC[] IS INITIAL.
        PERFORM DOWNLOAD TABLES T_BASIC[] USING P_BAS .
      ENDIF.
      IF NOT T_SALES[] IS INITIAL.
        PERFORM DOWNLOAD TABLES T_SALES[] USING P_SAL .
      ENDIF.
      IF NOT T_ERROR[] IS INITIAL.
        PERFORM DOWNLOAD TABLES T_ERROR[] USING P_ERR.
      ENDIF.
    *&      Form  PROCESS
          text
    FORM PROCESS.
      LOOP AT T_UPLOAD INTO WA_UPLOAD.
        PERFORM CONV_ROUTINE  USING WA_UPLOAD-MATNR
                            CHANGING WA_UPLOAD-MATNR.
        SELECT COUNT(*) FROM MARA WHERE MATNR = WA_UPLOAD-MATNR.
        IF SY-SUBRC NE 0.
          MOVE-CORRESPONDING  WA_UPLOAD TO WA_BASIC.
          APPEND WA_BASIC TO T_BASIC.
          CLEAR WA_BASIC.
          CONTINUE.
        ENDIF.
        SELECT COUNT(*) FROM MARC WHERE MATNR = WA_UPLOAD-MATNR
                                        AND WERKS = WA_UPLOAD-WERKS
                                        AND PSTAT LIKE '%V%'.
        IF SY-SUBRC NE 0.
          MOVE-CORRESPONDING  WA_UPLOAD TO WA_SALES.
          APPEND WA_SALES TO T_SALES.
          CLEAR WA_SALES.
          CONTINUE.
        ENDIF.
        CLEAR : WA_MTART.
        SELECT SINGLE MATNR MTART FROM MARA INTO WA_MTART WHERE MATNR = WA_UPLOAD-MATNR.
        PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0060'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'RMMG1-MATNR'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=AUSW'.
        PERFORM BDC_FIELD       USING 'RMMG1-MATNR'
                                      WA_UPLOAD-MATNR.
        CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW'     " Function module
        EXPORTING
          MATERIAL                  = WA_UPLOAD-MATNR  " Material number
          MATERIALART               = WA_MTART-MTART          " Material Type
          SELECTION                 = 'V'              "
          TCODE                     = 'MM02'           " Tcode where view's are called.
        TABLES
          BTCI_D0070                = IT_BDCDATA_VIEW
        EXCEPTIONS
          MATERIAL_NOT_FOUND        = 1
          MATERIAL_NUMBER_MISSING   = 2
          MATERIAL_TYPE_MISSING     = 3
          MATERIAL_TYPE_NOT_FOUND   = 4
          NO_ACTIVE_DYNPRO_SELECTED = 5
          NO_AUTHORITY              = 6
          OTHERS                    = 7.
        READ TABLE IT_BDCDATA_VIEW WITH KEY FVAL  = 'X'.
        IF SY-SUBRC = 0.
          V_SELECTION = IT_BDCDATA_VIEW-FNAM.
        ELSE.
          CONTINUE.
        ENDIF.
        VAR = IT_BDCDATA_VIEW-FNAM+17(2).
        VAR = VAR + 3.
        CONCATENATE 'MSICHTAUSW-KZSEL(' '0' VAR ')' INTO VAR1.
        PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0070'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'MSICHTAUSW-DYTXT(06)'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=ENTR'.
        PERFORM BDC_FIELD       USING VAR1
                                       'X'.
        CLEAR VAR.
        CLEAR VAR1.
       PERFORM BDC_FIELD       USING 'MSICHTAUSW-KZSEL(06)'
                                     'X'.
        PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0080'.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'RMMG1-VKORG'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=ENTR'.
        PERFORM BDC_FIELD       USING 'RMMG1-WERKS'
                                      WA_UPLOAD-WERKS.
        PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '4004'.
        PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                      '=BU'.
       PERFORM BDC_FIELD       USING 'MAKT-MAKTX'
                                     'MTI_ESE_HALB_01'.
        PERFORM BDC_FIELD       USING 'MARC-STEUC'
                                      WA_UPLOAD-STEUC.
        PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                      'MARC-HERKR'.
        PERFORM BDC_FIELD       USING 'MARC-HERKL'
                                      'IN'.
        PERFORM BDC_FIELD       USING 'MARC-HERKR'
                                      'MAH'.
        PERFORM BDC_TRANSACTION USING 'MM02'.
    move the error record into seperate internal table nad down load it ****
        IF MESSTAB-MSGTYP = 'E'.
          MOVE-CORRESPONDING WA_UPLOAD TO WA_ERROR.
          APPEND WA_ERROR TO T_ERROR.
          CLEAR WA_ERROR.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    "PROCESS
    *&      Form  UPLOAD_PROCESS
          text
         -->PFNAME     text
    FORM UPLOAD_PROCESS USING PFNAME.
      DATA : PFNAME1 TYPE STRING.
      PFNAME1 = PFNAME.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME            = PFNAME1
          FILETYPE            = 'ASC'
          HAS_FIELD_SEPARATOR = 'X'
        TABLES
          DATA_TAB            = T_UPLOAD[].
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    "UPLOAD_PROCESS
    *&      Form  CONV_ROUTINE
          text
         -->P_INPUT    text
         -->P_OUTPUT   text
    FORM CONV_ROUTINE   USING    P_INPUT
                     CHANGING P_OUTPUT.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT  = P_INPUT
        IMPORTING
          OUTPUT = P_OUTPUT.
    ENDFORM.                    "CONV_ROUTINE
    *&      Form  DOWNLOAD
          text
         -->GI_FINAL   text
         -->PFNAME     text
    FORM DOWNLOAD TABLES
                  GI_FINAL
                         USING  PFNAME .
      DATA : FNAME TYPE STRING.
      FNAME = PFNAME.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME                        = FNAME
          FILETYPE                        = 'DAT'
         WRITE_FIELD_SEPARATOR           = 'x'
            HEADER                          = '00'
          IMPORTING
            FILELENGTH                      =
        TABLES
          DATA_TAB                        =  GI_FINAL[]
          FIELDNAMES                      = GI_FIELDNAMES[]
      IF SY-SUBRC = 0.
        MESSAGE 'FILE DOWNLOADED SUCCESSFULLY' TYPE 'I'.
      ENDIF.
    ENDFORM.                    " DOWNLOAD
    Regards
    Siva Prasad

  • Can we have try/catch in a static block in a class?

    hi All
    i have a question about put a try/catch block in a static block in a class to catch exceptions that maybe thrown from using System.xxxx(). in my custom class, i have a static block to initialize some variables using System.xxx(). in case of any error/exception, i need to be able to catch it and let the caller know about it. i tried to put a try/catch block in the static block, and tried to rethrow the exception. but it is not allowed, how would i handle situation like this? thanks for your help and advise in advance.

    You could just swallow the exception inside try/catch
    block, and instead of throwing it out, just set a
    static variable to allow checking from outside
    whether the initialization succeeded, or check within
    the constructor / methods of this class for
    successful initialization, and throw the exception
    then. You could even save that exception in a static
    variable for later.Ouch, ouch, you're hurting my brain. This would allow someone to ignore a (presumably) fatal error. Throw a RuntimeException as indicated. You can wrap a checked exception in an unchecked one if need be.

  • LV7.1 Strange behavior with Automatic Error Handling occuring when it shouldn't [LV 7.1 Pro on WinXP for Tablet PC's]

    [LV 7.1 Pro on WinXP for Tablet PC's]
    I recently let a rather large LV app of mine run in the development environment while I was out for a couple of days. Upon returning I found that the app had hung for ~22 hours waiting for an answer to an Automatic Error Handling (AEH) dialog proclaiming an Error 7 in New File without any indication of the VI hierarchy that called New File.  I set about ensuring that AEH dialogs would not pop up and have not been able to discover how I could have possibly received one in the first place.
    Subsequent investigation revealed:
    Neither AEH option in Options>Block Diagrams were checked.
    Network problems had occurred around the time that the app had hung.  All file paths are network paths when running in the development environment, so the cause of the error was most likely valid, even if the AEH dialog appearance wasn't.
    My app has only one instance where the New File primitive is used by me. That subVI and all others above it in the hierarchy DO NOT have the AEH property enabled.  The error out cluster of New File in my subvi is wired.
    My app has three instances where New File is called from a vi.lib vi (Open/Create/Replace File.vi, Open Config Data.vi, and Prompt Web Browser Path.vi), none of which have the AEH property enabled.  Nor does any of their calling VI's.  All three instances also have their error out cluster wired.
    A utility to examine the AEH property of all VI's (with all top level and dynamic VI's loaded) in memory reported that only 1 of 308 vi's ( RGT Does File Exists.vi from the Report Generation Toolkit) had that property true.  That vi has no subVI's other than the File/Directory Info primitive and no calling VI's in common with any of the vi's that call New File, except a top level VI.
    As long as 'Enable automatic error handling dialogs' remains unselected in options>block diagram, I am unable to get an AEH dialog for either the New File or File/Directory Info primitives in a test VI with AEH property enabled and their error out clusters unwired no matter what invalid path I pass to the functions.  As soon as the options>block diagram>Enable AEH dialogs' is selected, both primitives fire AEH dialogs with no error out wired and don't when wired. i.e. works as advertised.
    In other words I can find no reason why I should have gotten the problem AEH dialog...
    I cannot afford for this app to hang because of a network problem, other portions of the app that were running concurrently correctly handled the error and, had the AEH dialog not appeared, the app would have made corrections or shutdown in an orderly fashion.
    Any ideas?

    Very good.
    Write Characters to File.vi>Open/Create/Replace File.vi>New File
    New File throws the error.  Open/Create/Replace strips the hierarchy from the source of the error.  Write Characters passes it to the General Error Handler.  I never looked above O/C/R file in the hierarchy except for enable automatic error handling property.  The tip-off should have been to realize that O/C/R file was stripping the hierarchy from the error and look above that. 
    The real irony is that Write Characters was being used to log error cluster data to an error log file...
    Save as... Copy without updating... the OEM 'Write Characters to File' is gone from this app.
    Thanx (a bunch)

  • Error Handling in File Adapter

    I have been working on a requirement where the file adapter picks up the file and gives to the BPEL for processing the data.
    So, in order to do Error Handling for file adapter, i have been reading the Oracle documentation for technology adapters. In that, some of the
    points which i felt valuable for my error handling when using file adapter are the uniqueMessageSeparator property, fault-policies for rejected messages,
    and one of the action for rejected messages could be writing the payload to a file or invoking any other webservice.
    In my composite, i have configured the file adapter as a service for reading files, and i defined the xsd using the native format builder....If i put some data like 'aaaa' in the attribute of type integer , the .csv file is being picked up and its being passed to the BPEL without any error ? I believe there should be a translation error...right...
    But i am not getting the error, please tell me if anything is wrong in my xsd....
    Here is my xsd...
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
    xmlns:tns="http://TargetNamespace.com/InboundService"
    targetNamespace="http://TargetNamespace.com/InboundService"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    nxsd:version="NXSD"
    nxsd:stream="chars"
    nxsd:encoding="US-ASCII"
    nxsd:hasHeader="true"
    nxsd:headerLines="1"
    nxsd:headerLinesTerminatedBy="${eol}"
    >
    <xsd:element name="names">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="name" minOccurs="1" maxOccurs="unbounded">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="FirstName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," />
    <xsd:element name="LastName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," />
    <xsd:element name="Number" type="xsd:integer" nxsd:style="terminated" nxsd:terminatedBy="${eol}" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    And for DB Adapter, there is a property called SchemaValidation, i think that is not there for File adapter, by default it will take care of validation i guess....In another composite, my file adapter is picking up the .xml file and if i put any wrong data over there, that is working fine, i am getting the translation error, but only here in the case of csv file, i am not getting the error. Experts, please help me in this regard...I am using SOA 11G
    Thanks,
    Naresh

    Hi Yatan,
    Thanks for the reply. I did the same way, where my composite is picking up an XML file and translation error is coming. Even the fault policies are working fine, like writing to a file and even invoking other web service. Its really good that you have achieved the same thing in csv files. But the same thing i am unable to achieve when my file adapter is picking up the csv file. I really cant understand where i am doing wrong.
    here is my XSD which i defined through my native builder format...
    <?xml version="1.0" encoding="UTF-8" ?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
    xmlns:tns="http://TargetNamespace.com/FileRecv"
    targetNamespace="http://TargetNamespace.com/FileRecv"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    nxsd:version="NXSD"
    nxsd:stream="chars"
    nxsd:encoding="US-ASCII"
    nxsd:hasHeader="true"
    nxsd:headerLines="1"
    nxsd:headerLinesTerminatedBy="${eol}"
    >
    <xsd:element name="Roots">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="FirstName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;" />
    <xsd:element name="LastName" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="," nxsd:quotedBy="&quot;" />
    <xsd:element name="Number" type="xsd:integer" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy="&quot;" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    the jca file ..
    <adapter-config name="FileRecv" adapter="File Adapter" wsdlLocation="FileRecv.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/FileAdapter" UIincludeWildcard="n*.csv"/>
    <endpoint-activation portType="Read_ptt" operation="Read">
    <activation-spec className="oracle.tip.adapter.file.inbound.FileActivationSpec">
    <property name="DeleteFile" value="true"/>
    <property name="MinimumAge" value="0"/>
    <property name="PhysicalDirectory" value="C:\files"/>
    <property name="Recursive" value="false"/>
    <property name="PollingFrequency" value="5"/>
    <property name="IncludeFiles" value="n.*\.csv"/>
    <property name="UseHeaders" value="false"/>
    </activation-spec>
    </endpoint-activation>
    </adapter-config>
    I told that the file will contain only 1 record while defining xsd and i kept a record whose values are John , Peter and akjdkjdskj.
    Now if the data is like above, the file is still getting picked up without any translation error and the BPEL is getting completed successfully...
    Is it possible for you to send your sample project and the csv file from which you have defined the xsd to me if you dont mind ?
    Thanks,
    Naresh

  • JSF error handling when the bean is not correctly loaded

    Hi,
    I am doing some error handling in JSF and I want to do it in an elegant way. I have the following scenario for error handling.
    When the bean is initialized I load the bean with values from DAO which give SQL Exceptions.
    Since the bean is not loaded I properly I have to send the user to an error page showing the error message why I am sending the user to this page.
    I can do it by [ FacesContext.getCurrentInstance.redirect("/error.jsf") ] doing so I will loose all the FacesMessages that are added by the exceptions.
    Instead I want to use the [ FacesContext.getCurrentInstance.dispatch("url") ] which will allow the transfer of the user but I get the following
    16:59:39,341 WARN [lifecycle] executePhase(RESTORE_VIEW 1,com.sun.faces.context.FacesContextImpl@8537f9) threw exception
    java.lang.ClassCastException: javax.faces.component.UIViewRoot
    and the method that I am calling is
    public static void programErrorEnd() {
    logger.info("in the prgmErrorEnd mehod");
    //intializing the contex object
    FacesContext ctx = FacesContext.getCurrentInstance();
    try {
    //ready to dispatch the url.
    //ctx.getExternalContext().redirect("app/error/prgmerror.jsf");
    ctx.getExternalContext().dispatch("error/prgmerror.jsf");
    } catch (IOException e) {
    //TODO what to do when there is an error at this stage.
    finally {
    ctx.responseComplete();
    }Thanks and Regarding
    Edited by: sgatl2 on Aug 28, 2008 2:32 PM
    Edited by: sgatl2 on Aug 28, 2008 2:45 PM

    Just let it throw the exception and define an error-page entry in the web.xml which catches the specified exception (or a superclass of it or a HTTP status code) and displays the error.jsf page accordingly.

  • Flex bug in global error handling

    My application's global error handler (uncaught error handler) works mostly, but I found a case where it doesn't work, but should.  Before I filed an official bug report I wanted to post the issue here.
    Here is the issue: in a module, ErrorEvents that are not listened for  and are dispatched by a Flex component are never caught in the application's uncaught error handler. 
    I have a sample project that demonstrates this.  Here is the module in my test case:
    <?xml version="1.0" encoding="utf-8"?>
    <s:Module xmlns:fx="http://ns.adobe.com/mxml/2009"
                 xmlns:s="library://ns.adobe.com/flex/spark"
                 xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Script>
        <![CDATA[
            private function onClickSparkDispatch():void {
                dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "test" ) );   // this isn't caught in the uncaught error handler
            private function onClickNonSparkDispatch():void {
                var nonSparkDispatcher:EventDispatcher = new EventDispatcher();
                nonSparkDispatcher.dispatchEvent( new ErrorEvent( ErrorEvent.ERROR, false, false, "test" ) );  // this is caught in the uncaught error handler
        ]]>
    </fx:Script>   
        <s:HGroup>
            <s:Button label="Module Spark Dispatch (broken)" click="onClickSparkDispatch()" />
            <s:Button label="Module Non-Spark Dispatch" click="onClickNonSparkDispatch()" />
        </s:HGroup>
    </s:Module>
    Using Flex 4.6
    My application statically links in the Flex SDK ("merged into code" in Flash Builder).
    My applications works around these two exsiting bugs:
         https://bugs.adobe.com/jira/browse/SDK-28018
         http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-flex-modules.html
    Is this a bug?
    Thanks,
    Rick

    It’s been reported.  Here is more information and a workaround. http://blogs.adobe.com/aharui/2011/04/catching-uncaughterror-in-flex-modules.html

  • Error Handling

    hi,
    I have an IDOC -> XI ->SOAP scenario.
    How do we handle error handling in the below scenarios i described:
    1. If i have an error in transmitting the xml to the receiver SOAP. How can i send an error email notification?
    2. A retry or resend has to occur for 8 hours i.e., we keep trying for 8 hours and if it fails then we need to notify through email. How can we do this?
    3. At the first failure transmission an email has to be notified and failure after 8 hours another email notification has to be sent so 2 emails will be sent for a failure transmission? Is this possible through XI?
    How can we achieve the above?
    Thanks,
    Tirumal

    Hi Tirumal,
    Configure 2 alerts.
    One to be triggered when there is the error in tramsmitting the SOAP XML.
    Next to be triggered after the retry for 8 hours. If you are using the BPM with wait, then you can associate the Alert with the Exception block of your BPM and trigger the same.
    Also, from SP14, Alerts can be triggered for errros in both integratioon engine and adapter engine.
    To create alerts , this blog can help you out,
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--step-by-step
    From SP14 onwards, activation of end to end monitoring is not needed for Alerting. Refer to this note 870232 for this info.
    If you are on Sp14, implement the note 913858.
    If you are below SP14, then also check this blog,
    /people/michal.krawczyk2/blog/2005/09/09/xi-alerts--troubleshooting-guide
    Regards,
    Bhavesh

  • 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.

  • Error handling for importing a file

    Hi, I have only been doing java for 1 semester, and have got terribly stuck on my final assg. I have to import a txt file, and catch any exceptions. I know I am not using the correct method to read the file, but am not sure what the alternatives are. I am getting a compile time..illegal character msg for my Mydata.txt file. Here is my code.
    PS I do have a CatalogueItem class and a bit more to the main class, I have not attached it as I do not want this to be too long.
    /The program reads 10 sets of catalogue data from the Mydata.txt file
    //it prompts the user to use one of the 5 menu options displayed on the screen
    //depending on which option is selected the program displays the data
    //back on the screen.
    import java.awt.*;
    import java.lang.*;
    import java .io.*;
    import java.util.StringTokenizer;
    import java.text.NumberFormat;
    import java.util.Locale;
    //set up a class to call on the constructors from the catalogueitem class
    public class Myassg5
         private static final int MAX = 10; //sets the length to 10(for most exp products)
         private static CatalogueItem[] prodlist; //sets array for product list
         NumberFormat cash = NumberFormat.getCurrencyInstance(new Locale("en","AU"));
         public static void main(String[] args) throws IOException
         CatalogueItem prodlist = new CatalogueItem[10];//sets the length to 10
         {//create Buffered FileStream and initialise to zero
         //use bufferedReader to read in data my Mydata.txt file.
         BufferedReader inFile = null;
         BufferedReader inFile = new BufferedReader(new FileReader(C:\Mydata.txt);
         //print a msg stating the file is loading
         System.out.println("Loading file data from Mydata.txt...10 item(s) OK");
         //initialise the array elments to zero
         for( int a = 0; a < prodlist.length; a++)
         prodlist[a] = 0;
         //if incorrect command lines were passed in display
         //usage msg and quit program
         if(prodlist.length != 1)
              System.out.println("Usage: java assg <Mydata.txt>");
              System.exit(0);
         try
              inFile = new BufferedReader(new FileReader(args[0]));
         //display the error and quit if the file is not found
         catch(FileNotFoundException e)
              System.err.println("File not found--program will terminate");
              System.exit(1);
         //display error msg and quit if there is a problem
         //when opening the file
         catch(IOException e)
              System.err.println("Error opening file--program will terminate")
              System.exit(1);
         //repeat this error handling process as often as neccessary
         boolean go = true;
         while (go)
         //get a line of data from the file
         boolean valid = false;
         CatalogueItem prodlist =-1;
         while(!valid)
         //read the line of text from the file
         String temp = null;
         try
              temp = inFile.readLine();
         //display error msg and quit if there is a problem
         //reading from the file
         catch (IOException e)
              System.err.println("error reading from the file--program will terminate");
         System.exit(1);
         //if the string is null the EOF has been reached
         if(temp ==null)
              valid = true;
              go = false;
         //close the file stream
         try
              inFile.close();
         //display error if there was a problem closing the file
         catch (IOException e)
              System.err.println("error closing data file")
         

    I think the problem is the "\M" in "C:\Mydata.txt". It is trying to make that into an escape character. Use "C:\\Mydata.txt" or "C:/Mydata.txt" instead.
    The logic here is odd. You open a BufferedReader for Mydata.txt, then you trash it without closing it and create another BufferedReader for whatever command line argument the user passes in. Which reader do you want to keep?

  • Error handling for RGB values

    Hi
    I am having problems doing error handling for RGB values. I have a Java applet with 3 JTextFields whose values are parsed as int variables and stored as ints. If a value is entered that is not a value between 0 and 255 is entered, the appropriate field/s should be set to an empty string.
    The problem I am having is that I am using try/catch block to try to parse as an int but then it breaks out of execution completely.
    I hope this makes sense and that someone can help.
    Thanks!

    this is because your code is probably inside one giant try catch block, what you need to do is have small ones in places where you do the parsing.
    post code and i can show you how to modify it

Maybe you are looking for