Handle Exception with RowsetIterate DataTag

Hi everybody...!!!...
I'm working with JDeveloper 10g version 9.0.5.2 modifying a software and when I'm trying to open a jsp page which is relationship with a ViewObject, JDeveloper show me an exception ArrayIndexOutOfBoundsException which I don't know how to resolve with RowsetIterate DataTag.
I'll be waiting your responses for my problem.
Greetings.

Hi...!!!...
I put a try - catch block over the data tag, but know appear this new message on rowsetIterate datatag:
Mensaje de Error: org.apache.struts.taglib.html.FormTag
java.lang.ClassCastException: org.apache.struts.taglib.html.FormTag
     at ReporteActividadesGenerar.jspService(ReporteActividadesGenerar.jsp:167)
     at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:139)
     at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349)
     at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
     at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
     at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
     at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:220)
     at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1069)
     at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:455)
     at oracle.jbo.html.struts11.BC4JRequestProcessor.processForwardConfig(BC4JRequestProcessor.java:100)
     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1485)
     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:527)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
     at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
     at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
     at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
     at com.ayi.caos.client.actions.SecurityFilter.doFilter(SecurityFilter.java:138)
     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:600)
     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
     at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
     at java.lang.Thread.run(Thread.java:534)

Similar Messages

  • Some basic questions how to handle Exceptions with good style

    Ok I have two really basic Exception questions at once:
    1. Until now I always threw all exceptions back all the way to my main method and it always worked well for me but now I am sitting at a big project where this method would explode the programm with throwings of very many exceptions in very many methods. So I would like to know if there is a more elegant solution.
    2. What do I do with exceptions that will never occur?
    Lets say I have a method like this:
    void main() {calculate();}
    void calculate()
    sum(3,5);
    void sum(int a,int b)
    MathematicsA.initialise("SUM"); // throws AlgorithmNotFoundException, will never occur but has to be handled
    }So what is the most elegant way?:
    h4. 1. Ignore because it will not happen
    void sum(int a,int b)
    try {MathematicsA.initialise("SUM");}
    catch(AlgorithmNotFoundException) {}
    }h4. 2. Print stacktrace and exit
    void sum(int a,int b)
    try {MathematicsA.initialise("SUM");}
    catch(AlgorithmNotFoundException e)
    e.printStackTrace();
    System.exit();
    }h4. 3. throw it everywhere
    void main() throws AlgorithmNotFoundException, throws ThousandsOfOtherExceptions  {}
    void calculate()  throws AlgorithmNotFoundException, throws HundretsOfOtherExceptions
    sum(3,5);
    void sum(int a,int b) throws AlgorithmNotFoundException
    MathematicsA.initialise("SUM");
    }h4. 4. Create special exceptions for every stage
    void main() throws MainParametersWrongException
    try {calculate();}
    catch(Exception e)
      throw new MainParametersWrongException();
    void calculate()  throws SumInternalErrorException
    try {sum(3,5);}
    catch (SumInternalErrorException)    {throw new CalculateException();}
    void sum(int a,int b) throws SumInternalErrorException
    try
    MathematicsA.initialise("SUM");
    } catch (AlgorithmNotFoundException e) {
    throw new SumInternalErrorException();
    }P.S.: Another problem for me is when a method called in a constructor causes an Exception. I don't want to do try/catch everytime I instantiate an object..
    Example:
    public class MySummation()
         Mathematics mathematics;
         public MySummation()
                 mathematics.initialise("SUM"); // throws AlgorithmNotFoundException
         void sum(int x,int y)
              return mathematics.doIt(x,y);
    }(sorry for editing all the time, I was not really sure what I really wanted to ask until i realised that I had in fact 2 questions at the same time, and still it is hard to explain what I really want to say with it but now the post is relatively final and I will only add small things)
    Edited by: kirdie on Jul 7, 2008 2:21 AM
    Edited by: kirdie on Jul 7, 2008 2:25 AM
    Edited by: kirdie on Jul 7, 2008 2:33 AM
    Edited by: kirdie on Jul 7, 2008 2:34 AM

    sphinks wrote:
    I`m not a guru, but give my point of view. First of all, the first way is rude. You shouldn`t use try with empty catch. "rude" isn't the word I'd use to describe it. Think about what happens if an exception is thrown. How will you know? Your app fails, and you have NO indication as to why. "stupid" or "suicidal" are better descriptions.
    Then for the second way, I`ll reccomend for you use not printStackTrace(); , but use special method for it:
    public void outputError (Exception e) {
    e.printStackTrace();
    }It`ll be better just because if in future you`d like to output error message instead of stack of print it on GUI, you`ll need change only one method, but not all 'try' 'catch' statements for changing e.printStackTrace(); with the call of new output method.I disagree with this. Far be it from me to argue against the DRY principle, but I wouldn't code it this way.
    I would not recommend exiting from a catch block like that. It's not a strategy for recovery. Just throw the exception.
    Then, the third way also good, but I suppose you should use throws only if the caller method should know that called method have a problem (for example, when you read parametrs from gui, so if params are inccorect, main method of programm should know about it and for example show alert window)."throw it everywhere"? No, throw it until you get to an appropriate handler.
    If you're writing layered applications - and you should be - you want to identify the layer that will handle the exception. For example, if I'm writing a web app with a view layer, a service layer, and a persistence layer, and there's a problem in the persistence tier, I'd let the service layer know what the persistence exception was. The service layer might translate that into some other exception with some business meaning. The view layer would translate the business exception into something that would be actionable by the user.
    And in all other cases I suppose you should use the fourth way. So I suppose it`s better to combine 2,3,4 ways as I have mentioned above.I don't know that I'd recommend special exceptions for every layer. I'd reuse existing classes where I could (e.g., IllegalArgumentException)
    Sorry, I can give you advice how to avoid problem with try-catch in constructor. :-(You shouldn't catch anything that you can't handle. If an exception occurs in a constructor that will compromise the object you're trying to create, by all means just throw the exception. No try/catch needed.
    You sound like you're looking for a single cookie cutter approach. I'd recommend thinking instead.
    %

  • Handling Exceptions with case statement - convert Exception to int value

    Hi,
    I'm developing a web app, with servlets.
    I'm catching Exceptions in my servlets, for example I would like a user to insert data into a form. If the data cannot be converted into a integer value a java.lang.NumberormatException is thrown.
    I would like to catch this and then create a message giving a more specific clue to what happened. Unfortunatly it's possible that other exceptions could be caught, so I want to be able to check which type of Exception has been caught.
    I started writing a getErrorMessage(int Code) class. The method has a case statement which just checks the code and return the appropriate message.
    This worked well for SQL exceptions as they provide a getErrorCode method. But I was wondering is there any way to convert other Exceptions such as
    java.lang.NumberormatException into an integer value?
    Cheers

    Exceptions have their types (classes) and messages (and maybe an embedded exception). That is, they have much richer internal status then an integer.
    Why should they be "converted" to integers?
    FLAME on
    Gone are the days of good old errno.
    FLAME off

  • Handling exceptions with servlets

    Hi All,
    I am trying to to write a servlet that would handle the errors of my applications under Application Server 8.1
    Therefore i used the below:
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class ErrorDisplay extends HttpServlet {
    public void doGet(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException {
    res.setContentType("text/html");
    PrintWriter out = res.getWriter();
    String code = null, message = null, type = null, uri = null;
    Object codeObj, messageObj, typeObj;
    Throwable throwable;
    // Retrieve the three possible error attributes, some may be null
    codeObj = req.getAttribute("javax.servlet.error.status_code");
    messageObj = req.getAttribute("javax.servlet.error.message");
    typeObj = req.getAttribute("javax.servlet.error.exception_type");
    throwable = (Throwable) req.getAttribute("javax.servlet.error.exception");
    uri = (String) req.getAttribute("javax.servlet.error.request_uri");
    if (uri == null) {
    uri = req.getRequestURI(); // in case there's no URI given
    // Convert the attributes to string values
    if (codeObj != null) code = codeObj.toString();
    if (messageObj != null) message = messageObj.toString();
    if (typeObj != null) type = typeObj.toString();
    // The error reason is either the status code or exception type
    String reason = (code != null ? code : type);
    out.println("<HTML>");
    out.println("<HEAD><TITLE>" + reason + ": " + message + "</TITLE></HEAD>");
    out.println("<BODY>");
    out.println("<H1>" + reason + "</H1>");
    out.println("<H2>" + message + "</H2>");
    out.println("<PRE>");
    if (throwable != null) {
    throwable.printStackTrace(out);
    out.println("</PRE>");
    out.println("<HR>");
    out.println("<I>Error accessing " + uri + "</I>");
    out.println("</BODY></HTML>");
    and i added the following to my web.xml
    <error-page>
    <exception-type>javax.servlet.ServletException</exception-type>
    <location>/opt/SUNWappserver/appserver/samples/webapps/apps/nav/servlets/ErrorDisplay</location>
    </error-page>
    I have written a program to divide by zero, however it didnt call the above customized page but it threw the caught exception.
    What is missing or what might i be doing wrong?
    Any thoughts?
    regards,
    Scotty

    the thrown exception is actually a ServletException? I would doubt that given the circumstances.

  • Yes, handling exception with CVI is possible

    I'm not talking about SEH but regular exceptions.
    First lookt at the demo code available at :
    http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/demo.c.html
    Once you understand what we expect from TRY, THROW and other, you could look
    at both files :
    http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/exception.h.htm
    l
    and
    http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/exception.h.htm
    l
    Finally if you want to use this mecanism in your own code, look at the
    Download page in the "Progammation C" section. At the bottom you should find
    the zip file you're looking for.
    Even if it looks cool, never forget to use the macros errChk and nullChk
    defined in
    Enjoy !
    Regards, Philippe
    Feel f
    ree to visit : http://perso.wanadoo.fr/philippe.baucour (aka The Rebel
    CVI Site)

    No. Sorry about that. I got many request for that but I simply do not have
    time. However, in the latest sample code available online I try to have
    comments in English. I guess it help some of you. Concerning the Exception
    source code, sure comments are in French but the code is pretty old (see the
    download page, 01/04/01). However, read it twice. Should not be that hard to
    figure out how to use TRY, CATCH and THROW
    Feel free to visit the home page where some explainations now exist in
    english
    If you are looking for a sample code illustrating one example or another try
    : http://perso.wanadoo.fr/philippe.baucour/src/functions/Client_us.html
    which is localized as well.
    As you can see I try to make some effort ;-)
    Philippe
    Feel free to visit : http://perso.wanadoo.fr/philippe.baucour
    "Vishi Anand" a �crit dans le message
    de news: 3e96eea2@newsgroups....
    > Good but can you please have something in english for poor folks like us
    who
    > don't know french. Would like to see what other tools/utils you got there.
    >
    > vishi
    >
    > "Philippe BAUCOUR" wrote in message
    > news:3e9662fe@newsgroups....
    > > I'm not talking about SEH but regular exceptions.
    > >
    > > First lookt at the demo code available at :
    > > http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/demo.c.html
    > >
    > > Once you understand what we expect from TRY, THROW and other, you could
    > look
    > > at both files :
    > >
    >
    http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/exception.h.htm
    > > l
    > > and
    > >
    >
    http://perso.wanadoo.fr/philippe.baucour/src/progc/exception/exception.h.htm
    > > l
    > >
    > > Finally if you want to use this mecanism in your own code, look at the
    > > Download page in the "Progammation C" section. At the bottom you should
    > find
    > > the zip file you're looking for.
    > >
    > > Even if it looks cool, never forget to use the macros errChk and nullChk
    > > defined in
    > >
    > > Enjoy !
    > > --
    > > Regards, Philippe
    > > Feel free to visit : http://perso.wanadoo.fr/philippe.baucour (aka The
    > Rebel
    > > CVI Site)
    > >
    > >
    > >
    > >
    > >
    >
    >

  • Exception with the type CX_SY_OPEN_SQL_DB occured and was not handled

    Hi Champs,
    I am working on an interface which picks up file uploaded in a XI server and process it. The Function module used is a Z function module, developed locally.
    I am uploading an tab limited file in XI server and a background job processes the file. The tab limited file contains Payelement Transaction ID as primary key.  And after validation of elements like WBS element, cost center etc the file is posted using BAPI BAPI_ACC_DOCUMENT_POST. And all the Payelement Trans Ids are also replicated in a Z table, with there status viz. Success or Error or Warning.
    After background job was completed, we found in Tcode SXMB_MONI that the file was in error.
    The error message was :
    Error during proxy processing An exception with the type CX_SY_OPEN_SQL_DB occurred, but was neither handled locally, nor declared in a RAISING clause The system tried to insert a data record, even though a data record with the same primary key already exists.
    But to my dismay, I found that some of the Payelement Trans Ids were posted for a document and are also replicated in my Z table.
    From the error it seems that we are inserting a record that is already there in the document. I have checked in for BAPI's input parameter, there is nothing duplicate.
    Note: Insertion in Z table is made after the BAPI BAPI_ACC_DOCUMENT_POST.
    Can you help me out in this issue as it is now getting into veins
    Reagrds,
    Nishant

    Hi,
    Even we have faced this kind of issue. In order to solve this just write the following code:
    1) Before inserting records in to Z table, write one select query on that table with primary key fields in where clause. Pass the value that are returned by BAPI BAPI_ACC_DOCUMENT_POST to the key field.
    2) If sy-subrc = 4, insert records in Z table else Continue and dont insert records in this table. 
    This will solve your problem.
    Regards,
    Prashant

  • Problem with  Handling  Exception  in Jsp

    hi
    I am unable to handling exception in Jsp.
    In my Simple Form i taken a simple text field named salary.
    Details.jsp
    <%@ page language="java" isErrorPage="true" errorPage="Det.jsp"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <html:html>
    <html:form action="/det.do">
    Enter Salary<html:text property="sal"/><br>
    <br>
    <html:submit value="SEND" />
    </html:form>
    </html:html>and my Actionclass is:
    package com.gurukul.util;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class DetUserAction extends Action {
         String s=null;
         int sal;
    public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
         try
         sal=Integer.parseInt(req.getParameter("sal"));
         if (sal>0)
              s="success";
         else
         throw new SalException(sal);}
         catch(SalException e)
              e.getMessage();
         return map.findForward(s);
    and my Formbean is
    package com.gurukul.util;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    public class DetUserAction extends Action {
         String s=null;
         int sal;
    public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse res) throws ServletException,IOException
         try
         sal=Integer.parseInt(req.getParameter("sal"));
         if (sal>0)
              s="success";
         else
         throw new SalException(sal);}
         catch(SalException e)
              e.getMessage();
         return map.findForward(s);
    }and my struts-config.xml is
                                  </form-bean>
                                  <form-bean name="DetUser"  
                           type="com.gurukul.util.DetUserForm">
                                  </form-bean>
    <action path="/det"
                          type="com.gurukul.util.DetUserAction"
                          name="DetUser"
                        input="/Details.jsp"
                           scope="request">
                           <exception key="errors.sal"
                           type="com.gurukul.util.SalException"
                           path="/jsp/Det.jsp"/>
                       <forward name="success" path="/jsp/DetailList.jsp"  />
                       <forward name="failure" path="/jsp/Details.jsp"/>
                         </action>and Det.jsp(i.e error jsp) is
    <%@ page language="java" isErrorPage="true"%>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <html:html>
    <center><b>
    Invalid Salary</b></center>
    <%= exception.getMessage() %>
    </html:html>but i didnt get exception on jsp.
    please help me
    Regards
    VAS

    hi
    can you please guide me how to handle exceptions in Jsp(struts)?

  • How to handle exception CX_SY_REF_IS_INITIAL

    hi experts,
    im working on a test scenario for abap mapping in SAP XI im getting this error
    An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled locally, nor declared in a RAISING clause Dereferencing of the NULL reference
    i understand that i need to catch this exception in the abap coding but i'm not familiar with oops concepts
    can any one please suggest me how to handle this exception for the following code...
    method IF_MAPPING~EXECUTE.
      break x1149.
    * initialize iXML
      TYPE-POOLS: ixml.
      class cl_ixml definition load.
    ** Instances & Variable declaration =======================
    * instance main factory
      TYPES: BEGIN OF t_xml_line,
              data(256) TYPE x,
            END OF t_xml_line.
      DATA: l_ixml TYPE REF TO if_ixml,
    * instance input stream factory
       l_streamfactory TYPE REF TO if_ixml_stream_factory,
    * instance input stream
      l_istream  TYPE REF TO if_ixml_istream,
    * instance input document
      l_document TYPE REF TO if_ixml_document,
    * instance parse input document
      l_parser TYPE REF TO if_ixml_parser,
    * instance for elements within the nodes
      node      TYPE REF TO if_ixml_node,
    *instance of nodemap
      nodemap   TYPE REF TO if_ixml_named_node_map,
    * instance for iterator
      iterator  TYPE REF TO if_ixml_node_iterator,
      name      TYPE string,
      value     TYPE string,
    * instance main factory
       o_ixml   TYPE REF TO if_ixml,
    * instance output document
       o_document TYPE REF TO if_ixml_document,
    * instance output stream
      o_istream  TYPE REF TO if_ixml_ostream,
    * instance parse output document
      o_parser  TYPE REF TO if_ixml_parser,
    * instance fot renderer
      renderer type ref to if_ixml_renderer,
      irc type i,
      l_xml_size   TYPE i,
    *ROOT ELEMENT
    l_element_MT_DEMANDTEC_COST TYPE REF TO if_ixml_element,
    *NEXT CHILD ELEMENT FROM THE ABOVE PARENT
    l_element_DT_DEMANDTEC TYPE REF TO if_ixml_element,
    *CHILDREN1 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_WHSE  TYPE REF TO if_ixml_element,
    *CHILDREN2 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_DC    TYPE REF TO if_ixml_element,
    *CHILDREN3 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_PLANT    TYPE REF TO if_ixml_element,
    *CHILDREN4 ELEMENT FOR DT_DEMANDTEC
    l_element_DT_QTY    TYPE REF TO if_ixml_element.
    *saving the xml document
      DATA: l_xml_table       TYPE TABLE OF t_xml_line.
      types: begin of t_source,
              whse(5),
              dc(4) ,
              plant(4),
              qty    type i,
             end of t_source.
      types: tt_source TYPE STANDARD TABLE OF t_source.
      data:  wa_source type t_source.
      data: it_source TYPE  tt_source,
            ivalue type string.
    * Procedures and business logic =======================================
    *   Creating the main iXML factory
      l_ixml = cl_ixml=>create( ).
    *   Creating a stream factory
      l_streamfactory = l_ixml->create_stream_factory( ).
    * create input stream
      l_istream = l_streamfactory->create_istream_xstring( source ).
    *  initialize input document
      l_document = l_ixml->create_document( ).
    *  Create a Parser
      l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
    * parse input document
      l_parser->parse( ).
    *   Validate a document
      l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    *   Parse the stream
      IF l_parser->parse( ) NE 0.
        IF l_parser->num_errors( ) NE 0.
          DATA: parseerror TYPE REF TO if_ixml_parse_error,
                str        TYPE string,
                i          TYPE i,
                count      TYPE i,
                index      TYPE i.
          count = l_parser->num_errors( ).
          WRITE: count, ' parse errors have occured:'.
          index = 0.
          WHILE index < count.
            parseerror = l_parser->get_error( index = index ).
            i = parseerror->get_line( ).
            WRITE: 'line: ', i.
            i = parseerror->get_column( ).
            WRITE: 'column: ', i.
            str = parseerror->get_reason( ).
            WRITE: str.
            index = index + 1.
          ENDWHILE.
        ENDIF.
      ENDIF.
    *   Process the document
      IF l_parser->is_dom_generating( ) EQ 'X'.
        refresh : it_source.
        node ?= l_document.
        CHECK NOT node IS INITIAL.
    *   create a node iterator
        iterator  = node->create_iterator( ).
    *   get current node
        node = iterator->get_next( ).
    *   loop over all nodes
        WHILE NOT node IS INITIAL.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
    *         element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
            WHEN if_ixml_node=>co_node_text.
    *         text node
              value  = node->get_value( ).
              if name eq 'DT_WHSE'.
                wa_source-whse = value.
              ELSEIF name eq 'DT_DC'.
                wa_source-DC = value.
              ELSEIF name eq 'DT_PLANT'.
                wa_source-PLANT = value.
              ELSEIF name eq 'DT_QTY'.
                wa_source-QTY = value.
                COLLECT wa_source INto it_source.
                CLEAR   wa_source.
              ENDIF.
          endcase.
          node = iterator->get_next( ).
        endwhile.
      ENDIF.
      loop at it_source into wa_source .
        at first.
    *       Creating a ixml factory
          o_ixml = cl_ixml=>create( ).
    *       Creating the dom object model
          o_document = l_ixml->create_document( ).
        endat.
    *       Build and Fill  root node MT_DEMANDTEC_COST
        AT FIRST.
          l_element_MT_DEMANDTEC_COST    =
    O_document->create_simple_element(
                                  name   = 'MT_DEMANDTEC_COST'
                                  parent = o_document ).
        ENDAT.
    *      Build and Fill  Child node DT_DEMANDTEC for parent
    *                                                  MT_DEMANDTEC_COST
        l_element_DT_DEMANDTEC    = O_document->create_simple_element(
                                     name   = 'DT_DEMANDTEC'
                                     parent = l_element_MT_DEMANDTEC_COST ).
    *      Build and Fill  Child node1 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-WHSE.
        l_element_DT_WHSE    = O_document->create_simple_element(
                                         name   = 'DT_WHSE'
                                         VALUE  = ivalue
                                         parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node2 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-DC.
        l_element_DT_DC   = O_document->create_simple_element(
                                             name   = 'DT_DC'
                                              VALUE  = ivalue
                                    parent = l_element_DT_DEMANDTEC ).
    *      Build and Fill  Child node3 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-PLANT.
        l_element_DT_PLANT   = O_document->create_simple_element(
                                                 name   = 'DT_PLANT'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node4 DT_QTY for parent DT_DEMANDTEC
        ivalue              = wa_source-QTY.
        l_element_DT_QTY     = O_document->create_simple_element(
                                                 name   = 'DT_QTY'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
      endloop.
    * render document ======================================================
    * create output stream
      o_istream  = l_streamfactory->create_ostream_xstring( result ).
    *   Connect internal XML table to stream factory
      o_istream  = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      renderer = o_ixml->create_renderer( ostream = o_istream
                                              document = o_document ).
      irc = renderer->render( ).
    * how do i catch the exception for type CX_SY_REF_IS_INITIAL ...?
    endmethod.
    full reward points for answers.
    Thanks & Regards,
    Uday Kumar.
    Edited by: UDAY on May 6, 2008 9:32 PM

    Hi Uday,
    Its occurs because you're trying to access a objects with null reference. Or you forgot to create an instance or an error occurs during the instance creation. So You should put all your "Procedures and business logic" inside a Try/catch block. as follow.
    " Define a class exception object to get error message......
    DATA o_exception TYPE REF TO cx_sy_ref_is_initial.
    "// Use the statment Try block to catch the error.
    TRY.
    *   Creating the main iXML factory
      l_ixml = cl_ixml=>create( ).
    *   Creating a stream factory
      l_streamfactory = l_ixml->create_stream_factory( ).
    * create input stream
      l_istream = l_streamfactory->create_istream_xstring( source ).
    *  initialize input document
      l_document = l_ixml->create_document( ).
    *  Create a Parser
      l_parser = l_ixml->create_parser( stream_factory = l_streamfactory
                                          istream        = l_istream
                                          document       = l_document ).
    * parse input document
      l_parser->parse( ).
    *   Validate a document
      l_parser->set_validating( mode = if_ixml_parser=>co_validate ).
    *   Parse the stream
      IF l_parser->parse( ) NE 0.
        IF l_parser->num_errors( ) NE 0.
          DATA: parseerror TYPE REF TO if_ixml_parse_error,
                str        TYPE string,
                i          TYPE i,
                count      TYPE i,
                index      TYPE i.
          count = l_parser->num_errors( ).
          WRITE: count, ' parse errors have occured:'.
          index = 0.
          WHILE index < count.
            parseerror = l_parser->get_error( index = index ).
            i = parseerror->get_line( ).
            WRITE: 'line: ', i.
            i = parseerror->get_column( ).
            WRITE: 'column: ', i.
            str = parseerror->get_reason( ).
            WRITE: str.
            index = index + 1.
          ENDWHILE.
        ENDIF.
      ENDIF.
    *   Process the document
      IF l_parser->is_dom_generating( ) EQ 'X'.
        refresh : it_source.
        node ?= l_document.
        CHECK NOT node IS INITIAL.
    *   create a node iterator
        iterator  = node->create_iterator( ).
    *   get current node
        node = iterator->get_next( ).
    *   loop over all nodes
        WHILE NOT node IS INITIAL.
          CASE node->get_type( ).
            WHEN if_ixml_node=>co_node_element.
    *         element node
              name    = node->get_name( ).
              nodemap = node->get_attributes( ).
            WHEN if_ixml_node=>co_node_text.
    *         text node
              value  = node->get_value( ).
              if name eq 'DT_WHSE'.
                wa_source-whse = value.
              ELSEIF name eq 'DT_DC'.
                wa_source-DC = value.
              ELSEIF name eq 'DT_PLANT'.
                wa_source-PLANT = value.
              ELSEIF name eq 'DT_QTY'.
                wa_source-QTY = value.
                COLLECT wa_source INto it_source.
                CLEAR   wa_source.
              ENDIF.
          endcase.
          node = iterator->get_next( ).
        endwhile.
      ENDIF.
      loop at it_source into wa_source .
        at first.
    *       Creating a ixml factory
          o_ixml = cl_ixml=>create( ).
    *       Creating the dom object model
          o_document = l_ixml->create_document( ).
        endat.
    *       Build and Fill  root node MT_DEMANDTEC_COST
        AT FIRST.
          l_element_MT_DEMANDTEC_COST    =
    O_document->create_simple_element(
                                  name   = 'MT_DEMANDTEC_COST'
                                  parent = o_document ).
        ENDAT.
    *      Build and Fill  Child node DT_DEMANDTEC for parent
    *                                                  MT_DEMANDTEC_COST
        l_element_DT_DEMANDTEC    = O_document->create_simple_element(
                                     name   = 'DT_DEMANDTEC'
                                     parent = l_element_MT_DEMANDTEC_COST ).
    *      Build and Fill  Child node1 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-WHSE.
        l_element_DT_WHSE    = O_document->create_simple_element(
                                         name   = 'DT_WHSE'
                                         VALUE  = ivalue
                                         parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node2 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-DC.
        l_element_DT_DC   = O_document->create_simple_element(
                                             name   = 'DT_DC'
                                              VALUE  = ivalue
                                    parent = l_element_DT_DEMANDTEC ).
    *      Build and Fill  Child node3 DT_WHSE for parent DT_DEMANDTEC
        ivalue              = wa_source-PLANT.
        l_element_DT_PLANT   = O_document->create_simple_element(
                                                 name   = 'DT_PLANT'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
    *      Build and Fill  Child node4 DT_QTY for parent DT_DEMANDTEC
        ivalue              = wa_source-QTY.
        l_element_DT_QTY     = O_document->create_simple_element(
                                                 name   = 'DT_QTY'
                                                  VALUE  = ivalue
                                   parent = l_element_DT_DEMANDTEC  ).
      endloop.
    * render document ======================================================
    * create output stream
      o_istream  = l_streamfactory->create_ostream_xstring( result ).
    *   Connect internal XML table to stream factory
      o_istream  = l_streamfactory->create_ostream_itable( table =
    l_xml_table ).
      renderer = o_ixml->create_renderer( ostream = o_istream
                                              document = o_document ).
      irc = renderer->render( ).
    "   The Statement CATCH define a block that catches the exceptions of the
    "   exception class cx_sy_ref_is_initial
        CATCH cx_sy_ref_is_initial INTO o_exception.
    " If you need to get the error message text do as follow
    DATA errorMsg type string.
    " Get the message text
      errorMsg = o_exception->GET_TEXT( ).
    " Display the error information
      MESSAGE errorMsg TYPE 'I'.
      ENDTRY.
    The TRY block defines a guarded area whose class-based exceptions can be caught in the subsequent CATCH blocks. If no exception occurs in the TRY block and it reaches its end, the system continues the processing after ENDTRY. If a class-based exception occurs in the TRY block, the system searches for an exception handler in the same or an external TRY control structure.
    Font: SAP Help
    You can see a how to create and use an exception in this example [ ABAP Objects - Defining a Class-based exceptions|https://wiki.sdn.sap.com/wiki/x/19w] .
    Best Regards.
    Marcelo Ramos

  • How to handle dbms_xmldom with no data values.(no_data_found error in dom)

    hi,
    i have below block,
    DECLARE
    doc dbms_xmldom.DOMDocument;
    node dbms_xmldom.DOMNode;
    elem dbms_xmldom.DOMElement;
    cur_node dbms_xmldom.DOMNode;
    root_elem_data dbms_xmldom.DOMElement;
    root_elem_tab dbms_xmldom.DOMElement;
    root_node_data dbms_xmldom.DOMNode;
    mode_elmn dbms_xmldom.DOMElement;
    mode_node dbms_xmldom.DOMNode;
    mode_text dbms_xmldom.DOMText;
    doc1 DBMS_XMLDOM.DOMDOCUMENT;
    root_node_data1 DBMS_XMLDOM.DOMNODE;
    child_document DBMS_XMLDOM.DOMDOCUMENT;
    child_rootnode DBMS_XMLDOM.DOMNODE;
    V_CLOB CLOB;
    v_doc CLOB;
    v_EMP CLOB;
    v_output_filename VARCHAR2(300) := 'SPOOL_DIR/'||'EMP_XML_FILE.xml';
    l_xmltype XMLTYPE;
    BEGIN
    doc := dbms_xmldom.newDOMDocument;
    node := dbms_xmldom.makeNode(doc);
    dbms_xmldom.setversion(doc, '1.0');
    dbms_xmldom.setCharset(doc, 'UTF8');
    elem := dbms_xmldom.createElement(doc, 'PartnerInfo');
    dbms_xmldom.setAttribute(elem,'xmlns','EMP');
    cur_node := dbms_xmldom.appendChild(node, dbms_xmldom.makeNode(elem));
    mode_elmn := dbms_xmldom.createElement(doc, 'EMPLOYEE');
    mode_node := dbms_xmldom.appendChild(cur_node,dbms_xmldom.makeNode(mode_elmn));
    BEGIN
    SELECT value(e) INTO l_xmltype
    FROM TABLE(XMLSequence(Cursor(SELECT * FROM EMP1 where EMPNO=7501))) e;
    child_document := DBMS_XMLDOM.newDOMDocument(l_xmltype);
    root_node_data1 := dbms_xmldom.importNode(doc,dbms_xmldom.makeNode(dbms_xmldom.getDocumentElement(child_document)),TRUE);
    root_node_data1 := DBMS_XMLDOM.appendChild(root_node_data, root_node_data1);
    EXCEPTION
    WHEN OTHERS THEN
    Dbms_Output.Put_Line('Error in SELECT stmt(UC_PARTNER_MS):::'||'error::'||SQLERRM);
    END;
    dbms_lob.createtemporary(v_doc, true);
    dbms_xmldom.writeToClob(doc,v_doc,'UTF8');
    v_EMP:= v_doc;
    dbms_xmldom.writeToFile(DOC,v_output_filename,'UTF8');
    dbms_xmldom.freeDocument(doc);
    --Dbms_Output.Put_Line('THE OUTPUT IS::'||V_EMP);
    EXCEPTION
    WHEN OTHERS THEN
    Dbms_Output.Put_Line('Error in SELECT stmt(UC_PARTNER_MS):::'||'error::'||SQLERRM);
    END;
    The xml file is 'EMP_XML_FILE.xml'
    <empno>U++kYmcVuGchxbh+++++++++++++++1+</empno>
    <empname>J</empname>
    suppose the empno 7501 is not available in our emp table,
    i got error
    ORA-03113: end-of-file on communication channel
    how to handle xmldom with no data values.
    by
    siva

    hi,
    please give the solution
    by
    siva

  • Invalid Handle Exception-What is the reason?

    I face with "Invalid Handle exception" (SQLException) while using the following code.
    Could anybody tell me the possible reasons/Situation the error rise?
    stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(SQLStmt);
         if(rs!=null){
    ResultSetMetaData rsm = rs.getMetaData();
         int totalcols = rsm.getColumnCount();
         Vector temp;
         while (rs.next()) {
         Vector temp = new Vector();
         for (int i = 1; i <= totalcols; i++) {
              String value = rs.getString(i);
              if (value == null) {
              value = "";
         temp.addElement(value);
         }//for loop ends here
         valueVector.addElement(temp);
         rs.close();
         stmt.close();     
    Thank you all

    Vector temp;
    while (rs.next()) {
    Vector temp = new Vector();Are you sure that this is the code you are running? The reason I ask is that I'm pretty sure that it won't compile, at least under JDK1.4. You should get a compile error something like "temp is already defined".
    If thats not the problem you need to find out on which line the error actually occurs. You can get this from the exception by calling the printStackTrace() method.
    Col

  • Handling exception logging in a Java task scheduler program?

    I need to design a Task Scheduler Where
    1) User should be able to schedule multiple task at the same time.
    2) There should be proper error handling on failure of any task and should not affect the other running tasks.
    I found the related programme at http://www.roseindia.net/java/example/java/util/CertainAndRepeatTime.shtml
    My concern is about handling of point 2 in program provided at above link. Say I schedule a recurring mail send process in above program which will be run first time on 12 september 2011 at 2 am, and will be repeated after every 2 hours Say a one process fais at 8 am. I want to log it in log file with task name and time details. Now if I look at above programme i.e CertainAndRepeatTime.java. This program will exit once it schedules all the tasks. Where and how should handle the logging?
    Posted at http://stackoverflow.com/questions/7377204/handling-exception-logging-in-a-java-task-scheduler-program but folks suggesting Quartz scheduler . My Limitation is that i can't for quartz because my project allows me to use only standard java library. Is there any way we can handle logging in the same programme in case of exception.

    Well, first of all I wouldn't trust any code from roseindia. So you might want to look for more reliable advice.
    As for your logging, you can add it for example to the TimerTask itself. I don't recommend adding logging to that roseindia cr*p though.

  • PI - Proxy processing An exception with the type CX_SY_CONVERSION_NO_NUMBER

    Hi All,
    We have PI sync scenario,SOAP to Proxy.
    We are geeting the below error in Proxy .
    Error during proxy processing An exception with the type CX_SY_CONVERSION_NO_NUMBER occurred, but was neither handled locally, nor declared in a RAISING clause The argument &#39; 1,000.000&#39; cannot be interpreted as a number.
    But when the same data got updated in Proxy.Not sure about the root cause of the error.
    Regards,
    Arun

    Hi ,
    It looks like proxy is not able to convert string to number or the format of number is incorrect. This is only possible reason of this exception.
    The argument ' 1,000.000' cannot be interpreted as a number.
    Check out if the format is correct.. .
    Regards
    Aashish Sinha

  • How to handle exceptions in a Service

    Hi,
    I'm trying to get the new Service (background thread) stuff working and am close but I have a problem with handling exceptions that are thrown in my Task. Below is my code, does anyone know if I am doing something wrong, or is this just a flaw in the system at the moment:
    Here is my service:
    public class TestService extends Service<String>
        protected Task<String> createTask()
            return new Task<String>()
                protected String call() throws Exception
                   System.out.println("About to throw exception from inside task");
                   throw new Exception("Test failure");
    }Here is my code using this service:
    public void doTest()
        final TestService test = new TestService();
        test.stateProperty().addListener(new ChangeListener<Worker.State>()
            public void changed(ObservableValue<? extends Worker.State> source, Worker.State oldValue, Worker.State newValue)
                System.out.println("State changed from " + oldValue + " to " + newValue);
        test.start();
    }When the task throws its exception I was hoping to get a state change to FAILED but the callback is never triggered. I've tried listening for invalidation of the state and also tried listening to all the other properties on Service (running, progress, exception, etc). There doesn't seem to be any feedback after the exception has been thrown.
    Am I using this wrong, or is it a bug?
    Cheers for you help,
    zonski

    Hi,
    This was working in the build #32. I updated the JavaFX to build #36 and it stopped working.
    I checked in the latest build #37 as well which was released last week and this doesn't work here as well.
    If the task is succeeding the state is getting changed to SUCCEEDED but in case of an exception there is no change in the state
    Edited by: user12995677 on Aug 3, 2011 2:07 AM

  • Handling exceptions inside a Presentation

    Hi people, I have a problem handling exceptions inside a Presentation that it is inside an screenflow (that it is inside a Global Creation Activity). This it is in some way related to this other thread: Managing transactions with DynamicSQL
    I have an Interactive Activity that renders an Object BPM's Presentation. This Presentation has dependent combos (i.e.: Country, State, City).
    Although I can add an exception transition to the Interactive Activity, if the BP-Method that fills the other combo fails, this exception transition it is not executed. Instead, it shows a screen with the stack trace.
    The solution I've found: catch the exception inside the BP-Method, and use this.showError let the user know that something went wrong.
    This solves my problem, but I'd like to know why ALBPM let me put an exception transition from an Interactive Activity? I mean, in which cases this transition could be executed
    Thanks in advance!

    This does not solve my problem, but I think that it would be a better design idea not to allow presentations to call server-side BP-Methods directly. Instead it should call a client-side BP-Method and from this method call the one in the server.
    This should improve the way we can handle an error that occurs on a server-side BP-Method
    It's for sure a "best practice", but I think it would be better if the tool help us to implemented this way
    What do you think?

  • To handle exception in insert query

    Hi ,
    I am trying it insert certain records from another table A to temp table B, while doing insert i am having exception of unique constraint in table B how can i check which record is throwing exception while inserting in table A
    for eg:
    insert into A
    select * from B;
    i need to handle exception in which record of B i am getting unique constraint error

    Hi,
    If you add an error logging clause (with keywords LOG ERRORS), then you can insert a row into another table for each row that can't be inserted according to your INSERT statement.
    To query table A to see which ids already exist in table B, you can say
    SELECT  *
    FROM    a
    WHERE   a_id  IN (
                          SELECT  b_id
                          FROM    b
    where b.b_id is the unique key in table b, and a.a_id is the value you're truing to insert into that column.
    If you just want to skip the insert when a matching row already exists, then use MERGE instead of INSERT.

Maybe you are looking for

  • Items not appearing in cascading dynamic list (not maximum items)

    Hi I am having an issue with cascading prompts in Crystal Reports 2008.  I have two cascade levels in this report.  The report worked fine for a few months until we recently noticed some items were not showing up on the first list.  In the database,

  • How do I collect, already purchased coins in an app?

    I bought coins in 4pics1word and cant claim my coins, but it took itoff my iTunes account.

  • Regarding RFC function module

    Hi , Our requirement is like this , we  have to send the material long text from r/3 to srm system for this we have developed a rfc function module with srm system as destination  .But when we are using this in the program while rfc funtion module is

  • Poor Sound Quality with iTunes 8

    I just installed iTunes 8, and all of the songs in my Library play with poor sound quality regardless of the view I have open. The sound is really muffled, but the voices and higher frequencies sound tinny and shaky. I tried playing with the Equalize

  • Upgrading early

    So my plan says I can't upgrade till may but my last upgrade happen in April 2 years ago. Isn't it after 20 months you can upgrade your phone?