Catch class based exceptions

hi
i am calling a outbound proxy class from a inbound proxy class. when i dragged the ourbound proxy the below code is inserted by system directly.
TRY.
CALL METHOD oref1->SEND_OUT
  EXPORTING
    OUTPUT = output
CATCH CX_AI_SYSTEM_FAULT .
ENDTRY.
i want to know the difference between writing just
CATCH CX_AI_SYSTEM_FAULT .
and
CATCH CX_AI_SYSTEM_FAULT . into objref. where objref refers to exception class CX_AI_SYSTEM_FAULT .
how does the system behave in either of the case if exception is raised.
thanks

In both cases, no short dump is generated, because the exception is caught. However, no info about the actual error can directly be retrieved like is done in the following example.
DATA: lv_message TYPE string,
      lr_error TYPE REF TO cx_sy_zerodivide,
      y TYPE i VALUE 10,
      x TYPE i.
TRY.
    x = y / 0.
  CATCH cx_sy_zerodivide INTO lr_error.
    lv_message = lr_error->get_text( ).
ENDTRY.
But this will only be of interest, when you want to determine the error. If the catch is part of another TRY  ENDTRY block, the error is navigated upwards the chain.
Hope this was somehow helpful.

Similar Messages

  • How to store a class-based exception as container element?

    Hello,
    In a BO type method, there are situations where unexpected class-based exceptions can occur, I handle them with TRY ... CATCH ... ENDTRY.
    If such an error occurs, my BO type method also returns a BO type method exception using a return code (as usually).
    1) Now, my question is how can I store the exception instance in the task container ? (so that to get more information about what happened... it is an unexpected error as I said)
    Note that my question may apply to any class instance.
    2) To achieve this, I have an idea but not sure if it's realistic (maybe the question is not realistic too ). I'll create a new BO type ZOOINSTANC with string attribute containing the serialized instance, with a method to display it.
    Example how it could work, in my BO type method (it returns EXCEPTION parameter of type ZOOINSTANC):
    TRY.
      CATCH cx_root INTO lo_exc.
        DATA l_exc TYPE string.
        CALL TRANSFORMATION id
            SOURCE oo = lo_exc
            RESULT XML l_exc.
        DATA l_bor_zooinstanc TYPE swc_object.
        swc_create_object l_bor_zooinstanc 'ZOOINSTANC' ''. "no key
        swc_set_property l_bor_zooinstanc l_exc.
        swc_set_element container 'EXCEPTION' l_exc.
        exit_return 1001 '' '' '' ''.
    ENDTRY.
    One important issue is that I don't know any API to display the instance :-p
    Do you have any ideas, advices, ... ?
    Thx
    sandra

    Hi Mike, thank you for your answer, and sorry for the delay.
    > I'd rather go with the idea of returning the error details in a structured format that you can view in the container
    Yes, but that's the issue as I don't know which exceptions can be triggered, as I'd like to handle all exceptions.
    > I'd also ask why it's necessary to use BOR for this?
    When a BOR method fails, I want technical support to have all the details of the error, not only a generic error message. It's why I want to store the exception in the workitem container, and be able to display it later.
    > It's obviously your own development, so why not use classes. Subclasses of CX_BO_ERROR are recognised by workflow and you can even  bring a proper message back to the WF log. There's also some info on this in the second edition of the WF book.
    I did a test using demo workflow WS56400159 ("absence"), where I forced CX_BO_ERROR right after SWX_FORMABS_CREATE call in CL_SWF_FORMABSENC / CREATE method, but it seems that only the short text of the exception is kept.
    So, I'm a little disappointed to see that we have a great exception "tool" with class-based exceptions, but only the last text is kept in the system! That would have been great to be able to store the whole information (the attributes, and the whole bunch of cascading exceptions (PREVIOUS attribute), instead of only a simple text).
    sandra

  • Handling general errors via class based exceptions

    Fairly standard scenario: I've got this.
      DATA:  l_requester TYPE xubname.
      CALL FUNCTION 'ENQUEUE_EZMYTAB'
        EXPORTING
          username             = i_username
        EXCEPTIONS
          foreign_lock         = 1
          system_failure       = 2
          OTHERS               = 3.
      CASE sy-subrc.
        WHEN 1.
          l_requester = sy-msgv1.
          RAISE EXCEPTION TYPE zcx_my_exception EXPORTING textid   = zcx_my_exception=>lock_error
                                                          user     = i_username
                                                          lockedby = l_requester.
        WHEN 2.
          RAISE EXCEPTION TYPE zcx_my_exception.
      ENDCASE.
    But what I really want for WHEN 2 is the class based exception of
    MESSAGE sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1...
    I.e., in my calling code, I want to catch the exception, and display whatever the original error message was as generated by the ENQUEUE function module.
    I suppose I could do this
    DATA: ls_error TYPE scx_t100key.
    WHEN 2.
      ls_error-msgid = sy-msgid.
      ls_error-msgty = sy-msgty.
      ls_error-msgno = sy-msgno.
      RAISE EXCEPTION TYPE zcx_my_exception EXPORTING textid = ls_error
    but I can't help feel I'm missing something staggeringly obvious...
    matt

    Hi Matt,
    this may sound too simple:
    For me the real advantage of class-based-exception is that they can be raised in an inner block and caught in an outer block at any level.
    I never use the exception attributes to communicate any details, but use
    IF SY-SUBRC NE 0.
      MESSAGE sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1... INTO lv_string.
      Raise Exception type zcx_my_exception.
    ENDIF.
    Catching the exception I may (roughly) know where it comes from. As the message variables are present, I can check their values or repeat the MESSAGE without INTO. The main function of MESSAGE INTO is for transparency, the ability to see the whole message in debugger in lv_string and the where-used-list if message is created by programmer..
    If I really need different reaction for different SY-SUBRC ( = different untyped exception), I'd rather create different class-based exceptions. This helps transparency.
    In other oo language you do not have an ABAP message concept with everywhere-present message variables. Why use this crutch of putting the message variable filled by functions exception into exception object attributes only to convert them back to message output?
    I prefer [KISS|http://en.wikipedia.org/wiki/KISS_principle].
    Regards,
    Clemens

  • ENQUEUE and Class-based Exceptions

    Hi,
    If I use the ENQUEUE Function module in a method which also raises class-based exceptions, I'd like to be able to raise equivalent class-based exceptions which map to the standard ENQUEUE function module exceptions.
    Normally I'd simply propogate the FM exception by calling MESSAGE ... RAISING and then raise my own exception with the message that the ENQUEUE FM returned in sy-msg* etc.
    But you can't have normal exceptions and class-based ones in the same method interface. Does anyone know if there's a SAP standard CX exception which has all the same messages and parameters in it so that we can raise the relevant class-based exception in the method after an ENQUEUE fails?
    Thanks
    Paul

    Hello Paul,
    I am not sure whether I understand your problem correctly, so please excuse me if I am completely off track
    I assume you want to transport the information that is normally stored in sy-msg variables via class-based exceptions.
    If you define your own exceptions, you can add attributes to the exception class. Any attributes, basically. I did something along this line by adding all relevant fields (message class, type, number, the four variables) as attributes to my exception class. Then, if you raise an exception with RAISE EXCEPTION TYPE <yourExceptionClass> and you use, for example, drag-and-drop from SE80 or the pattern feature for that, in the EXPORTING part of the statement you can fill these fields. As they are public fields, any method catching your exception can look into these and figure out what went wrong with the ENQUEUE.
    Hope this helps (if I understood your question right)
    Joerg

  • How do Standard class based exceptions understand an exception?

    Dear All,
    Can any one explain how does the standard class based exceptions understand and identify the specific exception. For example CX_SY_ZERODIVIDE is an exception class we use to catch the divide by zero exception. How does the class understand it. To clear my point  please refer the code below
    data: v1 type i,
            v2 type i.
    try.
    v2  = v1 / 0.
    catch CX_SY_ZERODIVIDE.
    The above code will work and an exception will be handled properly. But how??
    suppose if i write..
    try.
    v1 = Apple
    catch CX_SY_ZERODIVIDE.
    it obviously doesnt work.
    so my point is how does an exception class understand the exception?
    I have very poor knowledge about it, i have checked the class CX_SY_ZERODIVIDE and its methods. There is no code in it. .
    Any help would be greatly appreciated.
    Thanks and Regards,
    Abdullah.

    1) You can write your own log class. Call the log method from your catch
    2) Upgrade to JDK1.4.0 and you can use the Logger function
    3) Check jakarta for log4j

  • Where-used list for class-based exception texts

    G'Day,
    With traditional exceptions, one can look at a message, go to SE91 and do a where-used for that particular message. This is not possible with ZCX classes, a where-used can be done for the entire class but there doesn't seem to be a way to find where individual exception texts are raised.
    Now whilst exception classes do offer the possiblity of a far better structuerd approach that reduces the need for a where-used in first place, this is still a shortcoming of exception classes... or is it? (or am I missing some other way to search for it?)
    Cheers,
    Mike

    D'Oh! That one was so obvious that I was blinded by it  
    (Believe it or not I've been using ex. classes for some time!)
    However it still leaves another issue (which was actually the one that sparked this debate here in the office): In the old message concept it was far easier to navigate from an error to find the offending code. One could click on a message, see the message class/ID, drop into SE91 and (provided the where used is small enough) go straight to the offending code via a where-used.
    Unless class-based exceptions are caught and re-raised as an old MESSAGE statement with a message number, this is not so simple anymore. Or is it?
    Thanks,
    Mike

  • Working with class based exception and dynamic method calls

    Hi Gurus,
    we just changed out ERP from EHP6 to EHP7.
    Since we did so we are facing an issue with an Z-Report we are using quite often.
    This reports looks up Workitems and executes the according methods so that we can go into debugging if we were facing any problems or errors.
    since the EHP Upgrade this statement has problems:
      data:        lt_parmbind   type abap_parmbind_tab,         lt_excpbind   type abap_excpbind_tab,         lo_runtime    type ref to object.     call method lo_runtime->(iv_cls_method)       parameter-table       lt_parmbind       exception-table       lt_excpbind.this CALL METHOD Statement has Problem with the Exception Table. We are quite often getting DYN_CALL_METH_EXCP_NOT_FOUND short dumps with Exception "CX_SY_DYN_CALL_EXCP_NOT_FOUND".
    The system has problems handling the content of lt_excpbind. if i clear this table the CALL METHOD statement works fine.
    AS an example we are trying to call /IDXGC/CL_PD_PROCESS_STEPS-->CREATE_DATA. This method has 2 exceptions
    /IDXGC/CX_PROCESS_ERROR
    Process Layer Exception
    CX_BO_TEMPORARY
    Temporary Business Exception
    The Content of LT_EXCPBIND is
    INDEX
    NAME
    VALUE
    2
    /IDXGC/CX_PROCESS_ERROR
    1
    2
    CX_BO_TEMPORARY
    2
    From my point of view the Problem ist, that they are marked as "class based". I think so because if you looked up the SAP Help for the EXCEPTION-TABLE Statement it is written that is statement only works for none-classbased exception.
    I think that restriction is quiet clear. But what i am wondering about is.. that restriction also exists for EHP6. And in EHP6 it work. Does anyone know why? Or how i can change me CALL METHOD Statement that i will work again?
    Best Regards
    Udo

    Class-based exceptions must be caught using try/catch statement.
    Calling dynamically a method catchable exceptions are:
    CX_SY_DYN_CALL_EXCP_NOT_FOUND
    CX_SY_DYN_CALL_ILLEGAL_CLASS 
    CX_SY_DYN_CALL_ILLEGAL_METHOD
    CX_SY_DYN_CALL_PARAM_MISSING 
    CX_SY_DYN_CALL_PARAM_NOT_FOUND 
    CX_SY_REF_IS_INITIAL
    Anyway catching cx_root (as shown by Matthias) will catch everything is catchable.

  • Class based exception handling

    Hi everyone....
    I am new to object oriented abap.
    I would like to know more about exception handling using classes.
    please provide some good material or links on the topic?
    Points will be rewarded.......

    hi,
    Download the PDF from here.
    http://www.esnips.com/doc/6d16a298-9227-4d32-acf1-e91164c89daf/3-ABAP-Objects(P283)
    Follow this link too for tutorials.
    http://www.****************/Tutorials/OOPS/MainPage.htm
    Hope this helps, Do reward.
    Edited by: Runal Singh on Mar 14, 2008 3:28 PM

  • ABAP OO Exception Class based processing

    Hi there,
    Note: In going forward with SAP WAS 6.20, one can handle exceptions using exception-class based handling using RAISE EXCEPTION TYPE abc and then CATCHing it in TRY/ ENDTRY block. Standard method like GET_TEXT can be used to get the text of the exception raised.
    Question: If I know the EXCEPTION CLASS and Exception ID of my exception class, is it possible to get the exception text directly from the repository without creating the exception class object?
    E.g. Exception class is CX_MY_SECRET_ID
    and Exception IDs for this class are
    ID_NOT_FOUND,
    ID_EXPIRED,
    ID_IS_FOR_SPECIAL_ACCESS
    E.g. last two exception IDs are my warning conditions, and if such conditions are encountered, all I want to do is collect the warning messages. Whereas first exception ID condition (i.e. ID_NOT_FOUND) is an error for me, in which I have pass the exception back to the calling program. E.g. the source code is like this:
    PERFORM.......
    If ID is not found
       RAISE EXCEPTION TYPE ZCX_MY_SECRET_ID
               EXPORTING TEXT_ID = 'ID_NOT_FOUND'.
    else if ID has expired
       ...... then do I have to first raise the exception like raised above and CATCH it before I can get its text? or can I get the exception text directly without raising the exception first (as I know i have to retrieve the text of ZCX_MY_SECRET_ID exception class for Exception ID ID_EXPIRED)?
    In other words, if a certain condition is warning for my program, can I get the condition for that exception (from exception class based on exception class name and exception ID), or do I have to RAISE it first explicitely and then CATCH it immediately and execute GET_TEXT to get its text?
    Thanks very much!

    Hello Chetan,
    in basic the raise exception type xxx creates an exception object and aborts normal execution continuing in the enclosing try block.
    The Abap runtime contains some optimizations regarding the try block has an 'into xxx' clause. But as long you use the same exception you cant take benefit from this.
    As far I understand your problem you have two different kind of severities. So I would use 2 differnt exception classes (maybe derived from a common parent type, or one from the other).
    So both the code which throws the exception and the one which catches it are aware of the different semantic.
    Kind Regards
    Klaus

  • How to enhance exception class based on CX_ROOT

    I have created an exception class based on CX_ROOT (or CX_STATIC_CHECK, CX_DYNAMIC_CHECK). Now, I need to enhance its "constructor" method with my own parameters. How can I do this? Currently system does not allow this. But, I have seen many other exception classes enhanced the way I want? Any idea?
    Any pointers will be helpful.
    Regards, Neetu

    Hello Neetu
    Two steps are required to get additional IMPORTING parameters in the CONSTRUCTOR method of your exception class:
    (1) Create exception IDs (tabstrip Texts )
    Example:  ID=ZCX_SDN_CLASS, text=Invalid data type for field &FIELD& on screen &SCREEN& &REPORT&
    (2) Add corresponding instance attributes (read-only) to your exception class
    Examples: attributes FIELD, SCREEN, REPORT
    Now the CONSTRUCTOR has the additional IMPORTING parameters FIELD, SCREEN and REPORT.
    If you raise your exception class using id=ZCX_SDN_CLASS then the wildcards (e.g. &FIELD& in the text) will be replaced by IMPORTING parameter FIELD.
    Regards
      Uwe

  • Catching System.loadLibrary exceptions

    I looked at the JNI book examples, and none does that. So i conclude that it is better to let that exception propagate up the stack. It makes sense because otherwise class behavior would be undefined. If you have evidence to the contrary, please speak up.
    Thanks.
    chap2/HelloWorld/HelloWorld.java- static {
    chap2/HelloWorld/HelloWorld.java: System.loadLibrary("HelloWorld");
    chap2/HelloWorld/HelloWorld.java- }
    chap2/HelloWorld/HelloWorld.java-}
    chap3/IntArray/IntArray.java- static {
    chap3/IntArray/IntArray.java: System.loadLibrary("IntArray");
    chap3/IntArray/IntArray.java- }
    chap3/IntArray/IntArray.java-}
    chap3/IntArray2/IntArray.java- static {
    chap3/IntArray2/IntArray.java: System.loadLibrary("IntArray");
    chap3/IntArray2/IntArray.java- }
    chap3/IntArray2/IntArray.java-}
    chap3/ObjectArrayTest/ObjectArrayTest.java- static {
    chap3/ObjectArrayTest/ObjectArrayTest.java: System.loadLibrary("ObjectAr
    ayTest");
    chap3/ObjectArrayTest/ObjectArrayTest.java- }
    chap3/ObjectArrayTest/ObjectArrayTest.java-}
    chap3/Prompt/Prompt.java- static {
    chap3/Prompt/Prompt.java: System.loadLibrary("Prompt");
    chap3/Prompt/Prompt.java- }
    chap3/Prompt/Prompt.java-}
    chap3/Prompt2/Prompt.java- static {
    chap3/Prompt2/Prompt.java: System.loadLibrary("Prompt");
    chap3/Prompt2/Prompt.java- }
    chap3/Prompt2/Prompt.java-}
    chap4/InstanceFieldAccess/InstanceFieldAccess.java- static {
    chap4/InstanceFieldAccess/InstanceFieldAccess.java: System.loadLibrary("
    nstanceFieldAccess");
    chap4/InstanceFieldAccess/InstanceFieldAccess.java- }
    chap4/InstanceFieldAccess/InstanceFieldAccess.java-}
    chap4/InstanceFieldAccess2/InstanceFieldAccess.java- static {
    chap4/InstanceFieldAccess2/InstanceFieldAccess.java: System.loadLibrary(
    InstanceFieldAccess");
    chap4/InstanceFieldAccess2/InstanceFieldAccess.java- }
    chap4/InstanceFieldAccess2/InstanceFieldAccess.java-}
    chap4/InstanceMethodCall/InstanceMethodCall.java- static {
    chap4/InstanceMethodCall/InstanceMethodCall.java: System.loadLibrary("In
    tanceMethodCall");
    chap4/InstanceMethodCall/InstanceMethodCall.java- }
    chap4/InstanceMethodCall/InstanceMethodCall.java-}
    chap4/InstanceMethodCall2/InstanceMethodCall.java- static {
    chap4/InstanceMethodCall2/InstanceMethodCall.java: System.loadLibrary("I
    stanceMethodCall");
    chap4/InstanceMethodCall2/InstanceMethodCall.java- initIDs();
    chap4/InstanceMethodCall2/InstanceMethodCall.java- }
    chap4/InstanceMethodCall2/InstanceMethodCall.java-}
    chap4/MyNewString/MyNewString.java- static {
    chap4/MyNewString/MyNewString.java: System.loadLibrary("MyNewString");
    chap4/MyNewString/MyNewString.java- }
    chap4/MyNewString/MyNewString.java-}
    chap4/MyNewString2/MyNewString.java- static {
    chap4/MyNewString2/MyNewString.java: System.loadLibrary("MyNewString");
    chap4/MyNewString2/MyNewString.java- }
    chap4/MyNewString2/MyNewString.java-}
    chap4/StaticFieldAccess/StaticFieldAccess.java- static {
    chap4/StaticFieldAccess/StaticFieldAccess.java: System.loadLibrary("Stat
    cFieldAccess");
    chap4/StaticFieldAccess/StaticFieldAccess.java- }
    chap4/StaticFieldAccess/StaticFieldAccess.java-}
    chap4/StaticMethodCall/StaticMethodCall.java- static {
    chap4/StaticMethodCall/StaticMethodCall.java: System.loadLibrary("Static
    ethodCall");
    chap4/StaticMethodCall/StaticMethodCall.java- }
    chap4/StaticMethodCall/StaticMethodCall.java-}
    chap5/MyNewString/MyNewString.java- static {
    chap5/MyNewString/MyNewString.java: System.loadLibrary("MyNewString");
    chap5/MyNewString/MyNewString.java- }
    chap5/MyNewString/MyNewString.java-}
    chap6/CatchThrow/CatchThrow.java- static {
    chap6/CatchThrow/CatchThrow.java: System.loadLibrary("CatchThrow");
    chap6/CatchThrow/CatchThrow.java- }
    chap6/CatchThrow/CatchThrow.java-}
    chap6/InstanceMethodCall/InstanceMethodCall.java- static {
    chap6/InstanceMethodCall/InstanceMethodCall.java: System.loadLibrary("In
    tanceMethodCall");
    chap6/InstanceMethodCall/InstanceMethodCall.java- }
    chap6/InstanceMethodCall/InstanceMethodCall.java-}
    chap6/ThrowByName/ThrowByName.java- static {
    chap6/ThrowByName/ThrowByName.java: System.loadLibrary("ThrowByName");
    chap6/ThrowByName/ThrowByName.java- }
    chap6/ThrowByName/ThrowByName.java-}
    chap8/NativeString/NativeString.java- static {
    chap8/NativeString/NativeString.java: System.loadLibrary("NativeString")
    chap8/NativeString/NativeString.java- }
    chap8/NativeString/NativeString.java-}
    chap9/OneToOne/OneToOne.java- static {
    chap9/OneToOne/OneToOne.java: System.loadLibrary("OneToOne");
    chap9/OneToOne/OneToOne.java- }
    chap9/OneToOne/OneToOne.java-}
    chap9/OneToOne/OneToOne.java-
    chap9/SharedStubs/CPointer.java- static {
    chap9/SharedStubs/CPointer.java: System.loadLibrary("disp");
    chap9/SharedStubs/CPointer.java- SIZE = initIDs();
    chap9/SharedStubs/CPointer.java- }
    chap9/SharedStubs/CPointer.java-

    There are 2 choices, i guess:
    1) Catch and don't re-throw, thus allowing pure java methods to be called,
    even though native method calls will throw, and state might be undefined.
    2) Catch and don't re-throw: thus making all method calls on such a class
    to throw, since object instantiations will fail. But at least in this
    case, an object w/ undefined behavior won't be in use.
    And i guess one could choose one or the other based on circumstances. In
    my case, the class will pretty much be unworkable w/o native methods, so
    what would be the best choice?
    Looking at NetBeans source, i'm seeing 2 examples of 1, and 1 example of
    2. Both examples of 1 utilize fail-backs if library isn't found, such as
    not calling the native method involved. The example of 2, catches
    Exception but lets Throwables go thru, which means it doesn't catch
    UnsatisfiedLinkError, and NbDdeBrowserImpl is unusable it library isn't
    found. My situation is similar to this. I concluded for myself, that we
    should catch all 3 exceptions from System.loadLibrary, show error dialog
    w/ each exception's message, and re-throw each exception, because
    otherwise, 90% of methods in the class are going to throw, and there is no
    way to get any decent functionality out of it in such a situation. Would
    you agree w/ my conclusion?
    1.1)
    /tasklist/core/src/org/netbeans/modules/tasklist/core/Background.java
    private static void loadLibrary() {
    if (loadfailed) return;
    if (false == loaded) {
    try {
    // XXX be aware of #32080, that changes location of native
    libraries
    System.loadLibrary("tasklist_bgthreads"); // NOI18N
    loaded = true;
    } catch (Throwable t) {
    ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, t);
    loadfailed = true;
    1.2)
    tasklist/timerwin/src/org/netbeans/modules/tasklist/timerwin/AlwaysOnTop.java:
    try {
    setAlwaysOnTopMethod = Window.class.getDeclaredMethod(
    "setAlwaysOnTop", // NOI18N
    new Class[] {Boolean.TYPE});
    } catch (Throwable t) {
    // ignore
    if (setAlwaysOnTopMethod == null) {
    try {
    System.loadLibrary("alwaysontop"); // NOI18N
    libLoaded = true;
    } catch (Throwable t) {
    libLoaded = false;
    2) extbrowser/src/org/netbeans/modules/extbrowser/NbDdeBrowserImpl.java:
    try {
    if (org.openide.util.Utilities.isWindows()) {
    // should be 32 or 64 bit, but it may not be present on
    some jdks
    String sunDataModel =
    System.getProperty("sun.arch.data.model"); //NOI8N
    if (sunDataModel != null) {
    if ("64".equals(sunDataModel)) { //NOI18N
    System.loadLibrary(EXTBROWSER_DLL_64BIT);
    } else {
    System.loadLibrary(EXTBROWSER_DLL);
    } else {
    String javaVMName =
    System.getProperty("java.vm.name"); //NOI8N
    if ((javaVMName != null) && (javaVMName.indexOf("64")
    -1)) { //NOI18NSystem.loadLibrary(EXTBROWSER_DLL_64BIT);
    } else {
    System.loadLibrary(EXTBROWSER_DLL);
    } catch (Exception e) {
    DialogDisplayer.getDefault ().notify (
    new
    NotifyDescriptor.Message(NbBundle.getMessage(NbDdeBrowserImpl.class,
    "ERR_cant_locate_dll"),
    NotifyDescriptor.INFORMATION_MESSAGE)
    }

  • Oracle Arrays and getVendorConnection API and Class Cast Exception

    I 've gone through various threads relating to the topic of Oracle Arrays and the getVendorConnecton API call to avoid the class Cast Exception.. i ve used all these but am still facing the problem...
    I would appreciate it if some one could resolve the following queries :
    I am using Weblogic 8.1 SP5 with oracle 8i
    1. I read that the need to use the getVendorConnection API to make pl/sql proc calls with oracle arrays from the WL Server wont be required to avoid classCastException...
    I tried to use the connection from the WL connection pool ..but it didnot work....I used the getVendorConnection API ..which also doesnot seem to work..
    I got the Heurisitc Hazard exception...I used the Oracle 9i driver ie ojdbc14.jar ...after this the exception is not coming but still the code doesnt seem to work...
    the snippet of the code is pasted below :
    ~~~~~~~~~~~~~~~~~~~~~~~code is : ~~~~~~~~~~~~~~~~~~~
    /*below :
    logicalCon is the Connection from the WL connection pool
    JDBCcon is the JDBC connection. */
    <div> try </div>
    <div>{ </div>
    <div>
    <b>vendorConn</b> = ((WLConnection)logicalCon).getVendorConnection();
    </div>
    <div>
    //Calling the procedure
    </div>
    <div>
    //java.util.Map childMap1 = JDBCcon.getTypeMap();
    </div>
    <div>
    java.util.Map childMap1 = <b>vendorConn</b>.getTypeMap();
    </div>
    <div>
    childMap1.put("SST_ROUTE_ENTRY", Class.forName("svm.stport.ejb.StaticRouteEntry"));
    </div>
    <div>
    //JDBCcon.setTypeMap(childMap1);
    <b>vendorConn</b>.setTypeMap(childMap1);
    </div>
    <div>
    // Create an oracle.sql.ARRAY object to hold the values
    </div>
    <div>
    /*oracle.sql.ArrayDescriptor arrayDesc1 = oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR", JDBCcon); */
    </div>
    <div>
    oracle.sql.ArrayDescriptor arrayDesc1 =
    oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR", <b>vendorConn</b>); // here if i use the JDBCcon it works perfectly.... <u>^%^%^%</u>
    </div>
    <div>
    code to fill in the sst route entry array....
    .....arrayValues1 */
    </div>
    <div>
    /* oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, JDBCcon, arrayValues1); */
    </div>
    <div>
    oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, <b>vendorConn</b>, arrayValues1);
    </div>
    <div>
    callStatement = logicalCon.prepareCall( "? = call procName(?, ?, ?)");
    </div>
    <div>
    /* ..code to set the ?s ie array1 */
    </div>
    <div>
    callStatement.execute();
    </div>
    <div>
    }catch(Exceptio e){
    </div>
    <div>
    }</div>
    <div>
    finally </div>
    </div>{</div>
    <div>System.out.println(" I ve come to finally"); </div>
    <div>}</div>
    <div>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~code snippet ends here ~~~~~~~~~~~~~~``
    </div>
    I have observed that the control immediately comes to the finally block after the call to the createDescriptor line above with <u>^%^%^%</u> in the comment. If i use the JDBCCon in this line...it works perfectly fine.
    Any pointers to where anything is getting wrong.
    I have jst set the vendorCon to null in the end of the file and not closed it. Subsequently i have closed the logicalCon. This has been mentioned in some of the thread in this forum also.
    Thanks,
    -jw

    Jatinder Wadhwa wrote:
    I 've gone through various threads relating to the topic of Oracle Arrays and the getVendorConnecton API call to avoid the class Cast Exception.. i ve used all these but am still facing the problem...
    I would appreciate it if some one could resolve the following queries :
    I am using Weblogic 8.1 SP5 with oracle 8i
    1. I read that the need to use the getVendorConnection API to make pl/sql proc calls with oracle arrays from the WL Server wont be required to avoid classCastException...
    I tried to use the connection from the WL connection pool ..but it didnot work....I used the getVendorConnection API ..which also doesnot seem to work..
    I got the Heurisitc Hazard exception...I used the Oracle 9i driver ie ojdbc14.jar ...after this the exception is not coming but still the code doesnt seem to work...
    the snippet of the code is pasted below :
    ~~~~~~~~~~~~~~~~~~~~~~~code is : ~~~~~~~~~~~~~~~~~~~Hi. Show me the whole exception and stacktrace if you do:
    try
    vendorConn = ((WLConnection)logicalCon).getVendorConnection();
    java.util.Map childMap1 = vendorConn.getTypeMap();
    childMap1.put("SST_ROUTE_ENTRY" Class.forName("svm.stport.ejb.StaticRouteEntry"));
    vendorConn.setTypeMap(childMap1);
    oracle.sql.ArrayDescriptor arrayDesc1 =
    oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR",
    vendorConn);
    oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, vendorConn, arrayValues1);
    callStatement = logicalCon.prepareCall( "? = call procName(? ? ?)");
    callStatement.execute();
    }catch(Exception e){
    e.printStackTrace();
    finally
    try{logicalCon.close();}catch(Exception ignore){}
    System.out.println(" I ve come to finally");
    /*below :
    logicalCon is the Connection from the WL connection pool
    JDBCcon is the JDBC connection. */
    <div> try </div>
    <div>{ </div>
    <div>
    <b>vendorConn</b> = ((WLConnection)logicalCon).getVendorConnection();
    </div>
    <div>
    //Calling the procedure
    </div>
    <div>
    //java.util.Map childMap1 = JDBCcon.getTypeMap();
    </div>
    <div>
    java.util.Map childMap1 = <b>vendorConn</b>.getTypeMap();
    </div>
    <div>
    childMap1.put("SST_ROUTE_ENTRY", Class.forName("svm.stport.ejb.StaticRouteEntry"));
    </div>
    <div>
    //JDBCcon.setTypeMap(childMap1);
    <b>vendorConn</b>.setTypeMap(childMap1);
    </div>
    <div>
    // Create an oracle.sql.ARRAY object to hold the values
    </div>
    <div>
    /*oracle.sql.ArrayDescriptor arrayDesc1 = oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR", JDBCcon); */
    </div>
    <div>
    oracle.sql.ArrayDescriptor arrayDesc1 =
    oracle.sql.ArrayDescriptor.createDescriptor("SST_ROUTE_ENTRY_ARR", <b>vendorConn</b>); // here if i use the JDBCcon it works perfectly.... <u>^%^%^%</u>
    </div>
    <div>
    code to fill in the sst route entry array....
    .....arrayValues1 */
    </div>
    <div>
    /* oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, JDBCcon, arrayValues1); */
    </div>
    <div>
    oracle.sql.ARRAY array1 = new oracle.sql.ARRAY(arrayDesc1, <b>vendorConn</b>, arrayValues1);
    </div>
    <div>
    callStatement = logicalCon.prepareCall( "? = call procName(?, ?, ?)");
    </div>
    <div>
    /* ..code to set the ?s ie array1 */
    </div>
    <div>
    callStatement.execute();
    </div>
    <div>
    }catch(Exceptio e){
    </div>
    <div>
    }</div>
    <div>
    finally </div>
    </div>{</div>
    <div>System.out.println(" I ve come to finally"); </div>
    <div>}</div>
    <div>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~code snippet ends here ~~~~~~~~~~~~~~``
    </div>
    I have observed that the control immediately comes to the finally block after the call to the createDescriptor line above with <u>^%^%^%</u> in the comment. If i use the JDBCCon in this line...it works perfectly fine.
    Any pointers to where anything is getting wrong.
    I have jst set the vendorCon to null in the end of the file and not closed it. Subsequently i have closed the logicalCon. This has been mentioned in some of the thread in this forum also.
    Thanks,
    -jw

  • 'Class Cast Exception' while invoking a EJB from a Servlet

              Hi,
              I am working on J2EE applications.I am using Webgain studio and weblogic server.I
              got a problem while invoking EJB from the servlet.
              While calling an EJB from the servlet, it is giving that "Class Cast Exception".This
              is because, the remote home reference is not able to type casted to the"Home Interface"
              of the EJB, even if I type casted explicitly. It is creating the context and able
              to identify the EJB with the JNDI name.
              Could please help me in solving this problem.I am pasting the code here.
              Thanks in advance,
              Dharma
              public void doGet(HttpServletRequest req, HttpServletResponse resp)
                   throws ServletException, IOException
                        resp.setContentType("text/html");
                        PrintWriter out = new PrintWriter(resp.getOutputStream());
              try
              Context context=getInitialContext();
              Object reference=context.lookup("ArlProjContractorAppletSession");
              ArlProjContractorAppletSessionHome home=(ArlProjContractorAppletSessionHome)PortableRemoteObject.narrow(reference,ArlProjContractorAppletSessionHome.class);
              //Exception is occuring in the above statement. It is unable
              //to cast to the home interface          
                        ArlProjContractorAppletSession the_ejb=null;
              try
              the_ejb=home.create();
              System.out.println("the_ejb = " + the_ejb.toString());
              catch(Exception e)
              e.printStackTrace();
              catch(Exception e)
              e.printStackTrace();
                        // to do: code goes here.
                        out.println("<HTML>");
                        out.println("<HEAD><TITLE>Contractor TimeTracker</TITLE></HEAD>");
                        out.println("<BODY>");
                        // to do: your HTML goes here.
                        out.println("</BODY>");
                        out.println("</HTML>");
                        out.close();
              

              I came across this kind of problem once. My problem went away after I upgraded
              from 5.1 SP6 to 5.1 SP8.
              "Dharma" <[email protected]> wrote:
              >
              >Hi,
              >
              >I am working on J2EE applications.I am using Webgain studio and weblogic
              >server.I
              >got a problem while invoking EJB from the servlet.
              >
              >While calling an EJB from the servlet, it is giving that "Class Cast
              >Exception".This
              >is because, the remote home reference is not able to type casted to the"Home
              >Interface"
              >of the EJB, even if I type casted explicitly. It is creating the context
              >and able
              >to identify the EJB with the JNDI name.
              >
              >Could please help me in solving this problem.I am pasting the code here.
              >
              >Thanks in advance,
              >Dharma
              >
              >
              >public void doGet(HttpServletRequest req, HttpServletResponse resp)
              >     throws ServletException, IOException
              >     {
              >          resp.setContentType("text/html");
              >          PrintWriter out = new PrintWriter(resp.getOutputStream());
              >
              > try
              > {
              >
              > Context context=getInitialContext();
              >
              > Object reference=context.lookup("ArlProjContractorAppletSession");
              >
              > ArlProjContractorAppletSessionHome home=(ArlProjContractorAppletSessionHome)PortableRemoteObject.narrow(reference,ArlProjContractorAppletSessionHome.class);
              >
              >//Exception is occuring in the above statement. It is unable
              >//to cast to the home interface          
              >
              >          ArlProjContractorAppletSession the_ejb=null;
              >
              > try
              > {
              > the_ejb=home.create();
              >
              > System.out.println("the_ejb = " + the_ejb.toString());
              >
              > }
              > catch(Exception e)
              > {
              > e.printStackTrace();
              > }
              > }
              > catch(Exception e)
              > {
              > e.printStackTrace();
              > }
              >          // to do: code goes here.
              >
              >          out.println("<HTML>");
              >          out.println("<HEAD><TITLE>Contractor TimeTracker</TITLE></HEAD>");
              >          out.println("<BODY>");
              >
              >          // to do: your HTML goes here.
              >
              >          out.println("</BODY>");
              >          out.println("</HTML>");
              >          out.close();
              >     }
              >
              >
              >
              >
              >
              

  • How to handle method based exceptions in webdynpro abap?

    Hi ,
        I want to raise an exception from my method.....I am doing division operation inside my method...when I am entering a very large amount , that time I am getting run time error.....please someone help me to catch this exception and display on browser.
    Thanks & Regards
    Suman Kumar

    Hi Suman,
    You can catch the arithmetic exception by using exception class CX_SY_ARITHMETIC_ERROR as below
    Sample code:
              data lv_ex_msg               type string.
              data lx_sy_error              type ref to CX_SY_ARITHMETIC_ERROR.
              try.
                   "here goes your code
              catch CX_SY_ARITHMETIC_ERROR into lx_sy_error.
                               "  you can get exception text as below
                             lv_ex_msg = lx_sy_error->get_text( ).
                             or
                         " lv_ex_msg = lx_sy_error->get_longtext( ).
              endry.
    Hope this helps you.
    Regards,
    Rama

  • Class based error handling

    Hi evrybody,
    i'd like to implemt some own errorclasses, but i cand find anything about the namespace to use. Am i right that evry class based error handling must start with cx? So which namespace is for customoers?
    cu
      Rainer

    Hi Rainer,
    if you already have a regulation for class names, just replace CL by CX and apply them accordingly.
    For example, if your classes are named ZCL_... or YCL_..., your exception classes will be named ZCX... or YCX_..., respectively.
    See T100 message OO 145 for the details. Here is the German version:
    +Kurztext
    Klassenname &1 ist für den gewählten Klassentyp nicht zulässig
    Diagnose
    Namenskonvention für Klassen :
    Für eine persistente Klasse ist der Präfix 'CL_' bzw. Namensraum+Präfix 'CL_' ( z.B. 'ZCL' oder '/NAMESPACE/CL_' ) vorgeschrieben.
    Für eine Exceptionklasse ist der Präfix 'CX_' bzw. NamensraumPräfix 'CX_' ( z.B. 'ZCX' oder '/NAMESPACE/CX_' ) vorgeschrieben.
    Best regards,
    Thorsten Franz

Maybe you are looking for

  • ABAP/Excel: Method Save_as

    Dear all, Does anyone have experience with the method Save_as of the document proxy. Although I supply a filename as parameter the document name in Excel (in this case) is always the Document title under which the Document has been created initially.

  • Which upgrade for Late 2009 Mac Pro Currently Running 10.6.8?

    I am in a qaundry not knowing the best way to upgrade my machine. I would like to install Adobe Lightroom 5 but can not do it from Snow Leopard. I haven't upgraded because I was concerned about creating a nightmare of problems for myself. I use this

  • Option to select/deselect "SYNC" function no longer exists on Windows 7

    iTunes, version 9 (64 bit) no longer has an option to select/deselect "SYNC." I can choose to manually sync & if I REINSTALL iTunes, it RESETS to AUTOMATICALLY SYNC, but the option to choose AUTO-SYNC mode still does not appear. In the past, this fun

  • Hard drive dead - no Applecare - what to do?

    Help! Had iMac more than a year and stupidly didn't buy Applecare. Had 'Invalid Node structure' occur yesterday through Disk Utility and it hasn't started up since. Used DiskWarrior to get all my data off it but now I can't erase and install with my

  • No click when switching off

    Since upgrading to IOS7 my wife's iPad Mini no longer clicks when switching off or closing the cover. Her sound settings are the same as my 3rd Gen iPad which still clicks, any ideas how to recover the sound please?