Servlet being executed twice

          Hi all,
          I'm running WLS5.1, SP8 on W2K. I've written a servlet that instantiates and persists an entity bean. The servlet is registered in web.xml and mapped appropriately. If I run the servlet through the browser, everything works as expected.
          I've written a test case that opens a HttpURLConnection to the servlet, and instead of posting the data from a form (like through the browser), I appended the parameters to the querystring. When the test case executes, the servlet is executed twice, creating two identical rows in the database. So my test case fails expecting the entity to be unique.
          I see two servlet inits happening:
          <WebAppServletContext-vivaceApp> RequestProcessor: init
          and
          <ServletContext-General> classes: init
          Any ideas why this request is submitted twice?
          -EC
          

What you might want to do instead of sending email directly from the trigger, is create a job which sends the email. This way you make the sending of the email part of your transaction. When you issue a commit, the job gets submitted and the email is sent. When you rollback, the job is removed and no email is sent.

Similar Messages

  • Servlet doPost being called twice

    Hello all,
    I have a servlet that is being called twice. The servlet is used to direct the user to the next jsp. I have 4 JSPs that the user steps through to add a record to a database. The 1st JSP lists the records that they have and asks them to add, edit or delete. The servlet gets call to direct them to the next JSP that they enter the data (or update) on. It then calls a verification JSP so the user can verify the information before submitting it. If everything is fine they submit the data. This verification JSP calls the servlet that adds or updates the record in the database. The servlet then directs the user to a confirmation page that tells the user if the submit was successful or not.
    Here is how the flow is:
    servlet -->menu.jsp -->servlet -->add.jsp -->verification.jsp -->servlet -->confirmation.jsp
    Everything is fine until the verification.jsp submits to the servlet. That's where the doPost gets called twice.
    I have put System.outs in the servlet code to see how many times the doPost gets called. It gets called once for every JSP except the verification JSP. When the user submits the data, the servlet's doPost gets called twice therefore it tries to add the record twice.
    Has anyone had this problem before? How do I fix it?
    Any help would be greatly appreciated!!
    Tracey

    Here is the output of the JSP that when submitted, calls the doPost twice:
    <HTML>
    <HEAD>
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <TITLE>PreaPaid Legal Banner Verification</TITLE>
    <script language="javascript">
    function new_window(url){
    link = window.open(url,"Link","toolbar=0,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,width=650,height=450,left=50,top=50");
    </script>
    </HEAD>
    <BODY>
    <form name="myForm" action="/webapp/BannerTracker/BannerTrackingServlet" method="post">
    <H3><font face="Arial">Banner Tracking Verification</font></H3>
    <table BORDER=0 CELLSPACING=0 CELLPADDING=0 COLS=2 WIDTH=500><tr><td>
    <font face="Arial" size=2>Below are the choices that you made for your image, size of the image and page to direct people to
    when they click on your banner.
    <br><br>If this is not what you would like, click the "Back" button to return to the Banner Selection page.
    <br><br>You can click on the page link to view a sample of the age you have choosen.
    </font></td></tr></table>
    <P>
    <font face="Arial" size=2>
    <input type="hidden" name="cmd" value="doadd">
    <input type="hidden" name="banname" value="yahoo">
    <input type="hidden" name="banlogin" value="test">
    <input type="hidden" name="banid" value="1">
    <input type="hidden" name="bangname" value="difference">
    <input type="hidden" name="bangsize" value="468x60">
    <input type="hidden" name="banpage" value="go/test?:home">
    <input type="hidden" name="session" value="PPL2P6LcONLiT45pSszZEb1GJ4HvRc5jQMDNPM8wCJ0rCZesD38oEZ4mC3KvCp8mDp00">
    <input type="hidden" name="bangtype" value="gif">
    <input type="hidden" name="banurl" value="<A HREF="http://www.prepaidlegal.com/go/test?banid=1&Assoc=test"><img src="http://www.prepaidlegal.com/html/buttonsdifference468x60.gif" border=0></A>">
    <br><b>Banner name: </b>yahoo
    <br><br><b>Page to be directed: </b>Your PPL Home Page
    <br><br><b>Image selected: </b><img src=/html/buttons/difference468x60.gif >
    <br><br><b>Copy the URL below to the banner source code.</b>
    <br><br><img src="http://www.prepaidlegal.com/html/buttonsdifference468x60.gif " border=0>
    </font>
    <br><br>
    <a><img src="/html/buttons/track_back.gif" border=0 onClick="window.history.back();"></a>
    <input type=image src="/html/buttons/track_continue.gif" border=0 onClick="javascript:document.myForm.submit();">
    </form>
    </BODY>
    </HTML>
    Here is the doPost code from my servlet:
    public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
    System.out.println("doPost called");
    String next = "";
    try
    Command cmd = lookupCommand(req.getParameter("cmd"));
    next = cmd.execute(req);
    } catch (CommandException ce) {
    req.setAttribute("javax.servlet.jsp.jspException", ce);
    next = error;
    } catch (SQLException se) {
    req.setAttribute("javax.servlet.jsp.jspException", se);
    next = error;
    HttpSession mysession = req.getSession(true);
    String session = String.valueOf(mysession.getAttribute("storedSession"));
    if (session.equalsIgnoreCase("null"))
    session = req.getParameter("session");
    try
    checkSession(session);
    } catch (IOException ioe) {
    System.err.println("Session exception: " + ioe.getMessage() + ".");
    next = expire;
    } else {
    try
    checkSession(session);
    } catch (IOException ioe) {
    System.err.println("Session exception: " + ioe.getMessage() + ".");
    next = expire;
    if ( session != null )
    mysession.setAttribute("storedSession", session);
    RequestDispatcher rd;
    rd = getServletContext().getRequestDispatcher(jspdir + next);
    rd.forward(req, res);
    </code>
    I hope this helps.
    Tracey

  • Init() method is executing twice

    Hi,
    I have a servlet & implemented the init() method. But, the init() method is executing twice.
    Also, the destroy() method is executing twice.
    Any input guys.
    Thanks

    JAXMServlet most certainly IS an HttpServlet - the javadocs that I see say it extends HttpServlet. It won't be very useful in a SOAP implementation if it's not.
    I thought the SingleThreadModel interface. Why? I thought that was a bad practice that was discouraged. What writable data members does this "test" servlet have that require such careful treatment? If your servlet implements doGet and doPost methods, with only local variables, it'll be thread-safe enough.
    I follow the Sun Java coding standards, even for dash-off classes. "test" should be capitalized. Is there no more descriptive name you can think of?
    I'm not aware of a problem with Tomcat, and I haven't checked the bug list. But I'd put my money on your code being the problem here. Do you call super.init() in your servlet's init() method? Maybe you're seeing the superclass init() being called?
    %

  • JSP executing twice

    I am calling one JSP from another, via a Javascript function, as I am using the onclick event of an image button. I am using the following code in the calling JSP:
    <INPUT onclick="nextcitation(this.document)" accesskey="N" type="IMAGE" src="images/nextCitation1.gif">
    and the javascript function is as follows:
    function nextcitation(d)
    d.myform.action = "nccaNextCitation.jsp"
    d.myform.submit();
    return false;
    The called jsp, "nccaNextCitation.jsp" sometimes executes once, like it should, and other times it executes twice, using a second newly spawned thread. This causes a real problem, as I am using this JSP to call a servlet which feeds keystrokes in a screen scraping application to a legacy mainframe app.
    It's the inconsistency part to this that's driving me crazy. If it always happened on the first time the button was clicked or the 2nd time, it would be much easier to debug. As it is, it some time happens right away, and other times will be ok until the 5th or 6th time.
    I've searched the forums and google, and have found a few references where this happens, but none of the suggestions (mainly adding "return false") have worked.
    Is there some browser setting or something in the response header I should be looking for?
    I'm using IE 6.0 and WSAD 4.0.3 as my development tool/server.
    Thanks!

    An image input control is really a submit control. Double-submission can happen if you have an onClick handler on a submit button and have that method also do a form.submit(). You can recreate this problem using the following code (irrelevant sections are left out):
    function submitTheForm() {
        document.form.submit();
    <form>
    <input type="submit" name="submitthisform" value="Click Me" onClick="submitTheForm()">
    </form>In the above case, the form itself is submitted in response to the submit button being clicked, but also in response to the form.submit() call.
    Instead of using an image control, why not just use an HREF around an image instead? For example:
    <img src="images/nextCitation1.gif" border="0">
    Michael

  • Why does SunOne 6.1 call servlet init() method twice on startup

    Hi,
    SunOne6.1 sp 5 is running my servlet's init() method twice when I put load-on-startup in the web-xml file. Is this a known problem and is there a work around as no amount of synchronising seems to work.
    I'm running 2.3.dtd for the default_web.xml file and my entries look like this :-
    <servlet>
    <servlet-name>RelatisLogin</servlet-name>
    <servlet-class>com.MyServlet</servlet-class>
    <load-on-startup>7</load-on-startup>
    </servlet>
    This init method only contains a basic check at the moment :-
    public void init()
    System.out.println("init.....");
    If I take <load-on-startup> away and run the server then call the servlet via the url it only runs init once.
    I've tried synchronizing the block but this doesn't work.
    The synchonization code I used looks like this:-
    public void init(ServletConfig config) throws ServletException
    synchronized( AnotherClass.staticString )
    if ( AnotherClass.staticString.length() > 0 ) return;
    System.out.println( AnotherClass.staticString.length() );
    AnotherClass.staticString = "init has been called";
    try
    int i = 0;
    i = i/i;
    } catch(Exception e)
    e.printStackTrace();
    The declaration of "AnotherClass.staticString" is :-
    public static String staticString = "";
    The output of "System.out.println( AnotherClass.staticString.length() );" is 0 and displayed twice.
    I deliberately cause a divide by zero error to get a stack trace so that i can determine what called init(), the stack trace is printed twice and is always :-
    java.lang.ArithmeticException: / by zero
    at com.MyServlet.init(MyServlet.java:47)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:921)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:813)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3478)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3760)
    at com.iplanet.ias.web.WebModule.start(WebModule.java:251)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:652)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:355)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:995)
    at com.iplanet.ias.web.WebContainer.start(WebContainer.java:431)
    at com.iplanet.ias.web.WebContainer.startInstance(WebContainer.java:500)
    at com.iplanet.ias.server.J2EERunner.confPostInit(J2EERunner.java:161)
    It looks like SunOne starts then calls init() and then restarts and calls init() again.
    The same code and same web.xml entries work fine in Tomcat 5, init() only every gets called once.
    Any ideas? Can I post this as a bug?
    Thanks in advance for any help.
    Chris.

    Sorry to have not replied to this thread earlier.....forgot all about it.
    The reason init was being called twice by IPanet (Sun One) is IPanet comes with a default context called "Search" already in server.xml file.
    This context was loading all the classes on my class path and this causing "init" to run. Then my context entry also loaded all the files in the class path.
    Quite why Sun include this "Search" context is beyond me......annoying. If you take it out the the problem goes away.
    Basically if you leave this in then your running to web servers (JVM's) your one and Sun's stupid "Search" one. As they are separate JVM's no amount of synchronisation would ever fix it.

  • Operation Binding is executed twice

    Dear All,
    I created an Action Binding in my pageDef file. This will call the web service interface.
    In the action listener method of my button, I am invoking this action binding using this code
    below:
        OperationBinding method =
          getBindings().getOperationBinding("MyWebService");
        method.execute();All is well but I notice that when I looked at my HTTP Analyzer, I notice that my web service is called twice.
    Has anybody encountered this?
    I read about the blog by Shay about Web Service being called twice, https://blogs.oracle.com/shay/entry/web_service_across_pages_calle
    but I have a different use case than him as I have only one page.
    Anyone has hints?
    My problem causes double posting of transaction which is unnecessary.
    -JDEV 11G PS5
    -Web Service Business Services
    Edited by: Neliel on Nov 15, 2012 10:24 PM

    Have you tried to delay the call to the web service?
    Check https://blogs.oracle.com/shay/entry/delay_method_execution_when_us
    Timo

  • Iterators are executing twice

    Hi All
    I have noticed the iterators used on page fragments are being called twice once after loading the fragment and second time while unloading the fragment (i.e., navigating to other fragments), because of this the services are called twice, but we do not want the iterators executed while leaving the fragment.
    Iam using Jdev116
    Regards
    vidya

    Hi,
    You may want to set the iterator's refreshCondition to #{adfFacesContext.initialRender}.
    Check out this blog : https://blogs.oracle.com/shay/entry/preventing_queries_when_page_f
    -Arun

  • Sprint -- Form being submitted twice, IE only.

    Up front I'll state that this probably has nothing to do with Java, but I'll throw it out here just in case.
    On a particular page, when we put 19 or more items into a list in a form, when we submit that form, the onSubmit method of our subclass of org.springframework.web.servlet.mvc.SimpleFormController is getting called twice.
    This happens in IE, but not in Opera or Firefox.
    Because of the browser-specific nature of this problem, I'm pretty sure it's not related to Java, but if anybody has seen something like this before or has an idea where to start looking, I'd be very appreciative.
    This stuff was developed before my time, and I just started looking at it, so I'm not very familiar with it. It uses javascript, freemarker, and spring, none of which I'm familiar with. The only detail I've found for sure is that onSubmit is being called twice, and I'm a bit buggered as to where to look now.
    Thanks,
    Jeff

    Do the forms get submitted by using a javascript call to form.submit()?
    And is that javascript function called from an onclick event on an input type="submit"?
    That can (and does) result in a double submit in IE.
    It does not in firefox.
    Heres a quick jsp page that demonstrates this:
    <%! int count = 0; %>
    <html>
    <% System.out.println("Running..." + count++ + "Browser = " + request.getHeader("user-agent")); %>
    <script>
      function doStuff(button){
                     // submit via javascript
           button.form.submit();
    </script>
    <form>
      <input type="text" name="a1"/>
      <input type="text" name="a2"/>
      <input type="submit" onclick="doStuff(this)"/>
    </form>
    </html>This triggers two submits
    - one for calling form.submit();
    - one for pressing the submit button.
    To fix - remove/cancel one of the submission events, any of the following should work:
    - change the <input type="submit"> to an <input type="button">
    - change the onclick event to be "doStuff(); return false": returning false from an onclick event handler cancels the event - in this case it would cancel form submission.
    - remove the form.submit() javascript call
    Cheers,
    evanfets

  • How to get all parameter names along with their values in stored procedure which is being executed

    Im using sql server 2012, is there any possible way to get all the parameters of a stored procedure along with the values passed to it.
    I need these things to build a xml. I mean this should happen in the procedure which being executed and it should be common for all the procedures.
    For example, let us suppose we have to procedures,
    uspSave, @name='test' @age=20
    uspDelete @id=2
    now in uspSave procedure, i need to get @name, @age and the values 'test', 20 and in uspDelete, i should get @id with value 2.
    For getting the column names, i tried this,
    select parameter_name from information_schema.PARAMETERS where specific_name=OBJECT_NAME(@@procid)
    now is it possible to loop through the result of above query and can we get the values.

    I think  you need running SQL Server Profiler to capture this info even in SQL Server 2012.
    Best Regards,Uri Dimant SQL Server MVP,http://sqlblog.com/blogs/uri_dimant/
    Blog : MS SQL Development and Optimization
    Blog : Large
    scale of database and cleansing

  • 11.1.2- Need to find out what reports are being executed by a user

    Hi,
    We have financial reports executed from workspace.In essbase session , only the user id is displayed and the Request type- mdxreport is displayed. We also tried searching the log for Financial report didnt find anything relevant.
    Is there a way to find out what reports are being executed by the user.
    Thanks in advance.
    Regards,
    Saumya

    STAT will give you the information for a limited period of time and is limited to the server which you are logged onto yourself. Beyond 24 hours it is of even less use even if you change the selection screen values.
    If you want it for a period way back into the past, then you need to use ST03N.
    There are at least 2 dependencies and 1 confusion:
    1 dependency) The length of period is determined by the size (length) of the file. You can change this in ST03N (default 50MB) via the menu settings.
    2 dependency) The stat collector jobs need to be scheduled to write the information to ST03N (once per hour is a legal requirement in some non-banana republic countries).
    1 confusion) There is an obscure function which converts a report submit to a transaction name (there is not much difference anyway) and an even more obsure one which filters what ST03N will record and therefore whether you can read it. You can (un)filter these things away if you search the SAP Marketplace for the term "MONI".
    What is of particular value from this control is that you can even detect a submission of an abap which only existed temporarily.
    Also note that having this information is potentially very powerfull with respect to the users (some of them are human too), so you should expose and use it responsibly.
    You should also ensure that only responsible users / auditors have access to S_TOOLS_EX.

  • Why am i being charged twice for 11.04 and 11.46 when I did not purchase those songs, I used an itunes card 25$ and I still have 0.04 cents left?

    Why am i being charged twice for 11.04 and 11.46 when I did not purchase those songs, I used an itunes card 25$ and I still have 0.04 cents left?
    I couldnt redeem w/o an apple ID so when i did it asked for a credit card. And I want to discontinue and remove my account from itunes but it wont let me, there is no account discontinue or removal of account

    Because too much time has passed I can't edit this into the prior comment, but here is the info regarding reverting to iTunes 11.0.2 (assuming you do have a time machine backup) from https://discussions.apple.com/message/22057703#22057703
    W. Raider wrote:
    Repairing permissions doesn't fix it.
    I reverted to the previous version, 11.0.2.
    1. Quit the new crash-prone iTunes.
    2. Delete the app.
    3. Restore v. 11.0.2 with Time Machine.
    4. In your iTunes folder look for a folder called "Previous iTunes Libraries", find the latest one.
    5. In the iTunes folder itself you'll see "iTunes Library.itl", delete it (or compress it and save a copy for later just in case.
    6. Copy the newest .itl file in Previous iTunes Libraries to the iTunes folder and rename it "iTunes Library.itl".
    7. Launch the older version of iTunes.
    My crashing has seemed to have ceased with a revert to an older version. I noticed today that the newer crashing iTunes had been launched for hours but not playing anything, when I played internet radio it crashed within 5mins, fed up I reverted to an older version.
    Btw, a simpler way to do this is to revert to older iTunes app, then hold Option when it launches and choose an older library.

  • Wrong portions of code being executed in standard transactions

    Hi guys,
    I've recently come accross some weird errors in a standard transaction in a system and thought you might have a clue. I was getting an ugly dump in F110 in a fresh system that it can't do a READ TABLE with index 0. After investigating it and debugging it for a while, I got in the PAI of a screen, where two procedures were important:
    1) WERTE_PRUEFEN was being executed in a loop...endloop (that's where the error supposedly occurred). The thing is in the debugger it didn't go into this module inside the loop, as it should if there are no entries.
    2) After that, WERTE_LOESCHEN. When I got here and pressed F5 to see what's going wrong in it, guess where the debugger redirected me: you're right, to the WERTE_PRUEFEN thingy. So a statement like MODULE WERTE_LOESCHEN. gets me to a completely different procedure. This is crazy!
    I'm not at my first experience with this. BEx applications would do this if you'd change the ABAP source code and the people wouldn't reconnect again. Even if in the debugger I'd see the new code, the system would execute the old one, probably some caching issues. Always worked when people disconnected / reconnected.
    However, in the actual situation, no matter how many times I log on/off, the dump is there.
    This is not the only example of this kind, there are more module statements gone crazy in F110 in this system, but only this one dumps instantly.
    What do you think it could be the cause of that/ what is a good solution for this?
    I was thinking it has something to do with the program's generation and I asked the Basis guys to run an SGEN, hopefully that would help.
    Thanks in advance,
    George

    Hi Vikranth,
    Nope, just pressing F5 trying to get into WERTE_LOESCHEN and being redirected to that module inside the LOOP...ENDLOOP, WERTE_PRUEFEN. Well, I didn't say this happens in every system, only in that specific one. Of course, if I logon in another system, everything looks fine.
    Another person suggested that it's the GUI to blame and that I should get the newest version. Still, the error was reported by a person that has the latest version of the GUI. I still think it's a generation/ installation issue but got no reply from the Basis admin so far.
    Regards,
    George

  • XSLT for adding Namespace is not being executed at runtime

    Hi Gurus,
    I am trying to add a Namespace to inbound xml and I wrote a simple XSLT mapping as below, when I execute this using XML spy or in Operation mapping manually it is working fine and giving me output as expected but at runtime it is not executing, I am getting same input xml as output xml and receiver agreement is failing...
    Appreciate your thoughts..
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
         <xsl:output method="xml" encoding="UTF-8"/>
            <xsl:template match="*">
              <ns0:SalesXmlExtended xmlns:ns0="urn:/company.com/H/sndr">
              <xsl:copy-of select="//SalesReportInfo"/>
         </ns0:SalesXmlExtended>
         </xsl:template>
    </xsl:stylesheet>
    input xml is as below....
    <?xml version="1.0" encoding="UTF-8"?>
    <SalesXmlExtended>
         <SalesReportInfo>
              <SalesReport>
                   <Detail>
                        <deptNum>0270</deptNum> etc...
    output I am getting in XMLSpy and OM is as below, this is exactly what I need...
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:SalesXmlExtended xmlns:ns0="urn:/company.com/H/sndr">
         <SalesReportInfo>
              <SalesReport>
                   <Detail>
                        <deptNum>0270</deptNum>
    Thanks...
    Sukarna...

    Hi Baskar,
    Yeah, that is what my issue is , it shouldn't be failing but it is...
    I tried by manipulating the required namespace in the input file and it is working fine with out any errors....so I am guessing the XSLT is not being executed...
    I am getting below error which is valid because the transformation is not happening
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Technical Routing --> <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="">
    <SAP:Category>XIServer</SAP:Category>
    <SAP:Code area="OUTBINDING">CO_TXT_OUTBINDING_ERROR</SAP:Code>
    <SAP:P1>-BS_HOUSE_OF_FRASER_DEV</SAP:P1><SAP:P2>-BD1_100,urn:.com/HoF/POS/EOD/sndr.SI_Out_HoFSales_XML</SAP:P2>
    <SAP:P3/>
    <SAP:P4/>
    <SAP:AdditionalText>No standard agreement found for , BS_HOUSE_OF_FRASER_DEV, , BD1_100, urn:/HoF/POS/EOD/sndr, SI_Out_HoFSales_XML</SAP:AdditionalText
    ><SAP:Stack>Problem occurred in receiver agreement for sender -BS_HOUSE_OF_FRASER_DEV to receiver -

  • After Update Trigger executes twice when single row is uptd thro proc

    We have the below trigger in our db. When a single record is updated using a procedure the trigger is executed twice and it inserts two records in other table.
    But when i issue an update statement using any sql client tool it is executing only once and inserts only one record in other table.
    Can any one please help me to find the reason?
    Trigger:*
    create or replace TRIGGER CX_HEADER_ESCL_T1 AFTER UPDATE OF STATUS ON CX_HEADER
    FOR EACH ROW
    DECLARE
    "b1-CTRIYJ" boolean := FALSE;
    BEGIN
    IF UPDATING('STATUS') AND(:NEW.status = 'SUCCESS') THEN
    "b1-CTRIYJ" := TRUE;
    END IF;
    IF "b1-CTRIYJ" = TRUE THEN
    INSERT
    INTO siebel.s_escl_req(req_id, created, bt_row_id, rule_id, tbl_name, created_by, group_id)
    VALUES('11111111', CURRENT_DATE, :NEW.row_id, '1-CTRIYJ', 'CX_HEADER', :NEW.last_upd_by, '1-2CU3');
    "b1-CTRIYJ" := FALSE;
    END IF;
    END;
    Procedure:
    CREATE OR REPLACE
    PROCEDURE CLOSE_BATCH
    (ChildRecordCount IN NUMBER, HeaderId IN VARCHAR2, CompletionStatus OUT VARCHAR2) AS
    CafeChildCount NUMBER;
    BEGIN
    select count(*) into CafeChildCount from SIEBEL.CX_CHILD where HEADER_ID=HeaderId;
    IF ChildRecordCount = CafeChildCount THEN
    update SIEBEL.CX_HEADER set STATUS ='SUCCESS', MODIFICATION_NUM = MODIFICATION_NUM+1 where HEADER_ID=HeaderId;
    CompletionStatus := 'SUCCESS';
    ELSE
    update SIEBEL.CX_CHILD set STATUS='FAILED' where HEADER_ID=HeaderId;
    update SIEBEL.CX_HEADER set STATUS='FAILED' where HEADER_ID=HeaderId;
    CompletionStatus := 'FAILED';
    END IF;
    commit;
    /*CompletionStatus := 'SUCCESS';*/
    EXCEPTION
    WHEN OTHERS THEN
    CompletionStatus := SQLCODE;
    rollback;
    END;

    Your problem seems not be related to the trigger restart issue I have already mentioned because you are using a AFTER UPDATE trigger and not a BEFORE UPDATE trigger:
    >
    BEFORE Triggers Fired Multiple Times
    If an UPDATE or DELETE statement detects a conflict with a concurrent UPDATE, then Oracle Database performs a transparent ROLLBACK to SAVEPOINT and restarts the update. This can occur many times before the statement completes successfully. Each time the statement is restarted, the BEFORE statement trigger is fired again. The rollback to savepoint does not undo changes to any package variables referenced in the trigger. Your package should include a counter variable to detect this situation.
    >
    If you are sure that you update a single row and that your trigger fires twice and if you can easiily reproduce the issue, I recommend that you contact Oracle Support and create a Service Request for your issue that could be an Oracle bug.

  • Call to java bean but code not being executed.

    Making a call to my javabean class called ch06_03.java from a jsp program shown below:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Using a java package.</title>
    </head>
    <body>
    <% beans.ch06_03 messager = new beans.ch06_03(); %>
    The message is: <%= messager.msg() %>
    </body>
    </html>
    The call from jsp to javabean program is only returning the hello from java and NOT EXECUTING ANY OF THE CODE in the msg() method. I am checking my table landings_hold and nothing is there, my log file shows nothing. Why is the code not being executed except for the return statement?
    My javabean program is shown below:
    package beans;
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import java.sql.*;
    public class ch06_03 {
    StringTokenizer st1;
              String val1, val3, val4, val5, val9, val10, val11, val12, val13, val14, val16;
              String val2, val6, val7, val8, val15, val17, val18, val19, val20;
              int cnt;
              String filetext = "Starting RIFIS Upload";
              java.util.Date d = new java.util.Date();
              SimpleDateFormat form = new SimpleDateFormat("dd/MMM/yyyy hh:mm:ss");
              String dateString = form.format(d);
    public String msg() throws Exception {
         try {
         Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@xxxxx.xxxx.xxx:1521:xx","xxxxxx","xxxx");
              Statement st = conn.createStatement();
         File f = new File("C://upload");
              FileWriter outFile = new FileWriter("C://RIFIS/log/logfile.txt", true);
              outFile.write(System.getProperty("line.separator"));
              outFile.write(filetext+" - "+dateString);
              if (f.isDirectory())
              { String [] s = f.list();
              for (int i=0; i<s.length; i++)
              { outFile.write(System.getProperty("line.separator"));
                   outFile.write("Found file - "+f+"/"+s);
              FileReader file = new FileReader(f+"/"+s[i]);
                   File inputFile = new File(f+"/"+s[i]);
                        File outputFile = new File("C://RIFIS/archive/"+s[i]);
                   BufferedReader buff = new BufferedReader(file);
                   boolean eof = false;
                   String val0="";
                   ResultSet rec = st.executeQuery("SELECT landings_hold_batch_seq.nextval FROM dual");
                        while(rec.next())
                        { val0 = rec.getString(1); }
                        cnt=0;
                        while (!eof)
                        { String line = buff.readLine();
                        if (line == null)
                        { eof = true; }
                             else
                             { cnt = cnt+1;
                                  st1 = new StringTokenizer(line,",");
                                  val1 = st1.nextToken();
                                  val2 = st1.nextToken();
                                  val3 = st1.nextToken();
                                  val4 = st1.nextToken();
                                  val5 = st1.nextToken();
                                  val6 = st1.nextToken();
                                  val7 = st1.nextToken();
                                  val8 = st1.nextToken();
                                  val9 = st1.nextToken();
                                  val10 = st1.nextToken();
                                  val11 = st1.nextToken();
                                  val12 = st1.nextToken();
                                  val13 = st1.nextToken();
                                  val14 = st1.nextToken();
                                  val15 = st1.nextToken();
                                  val16 = st1.nextToken();
                                  val17 = st1.nextToken();
                                  val18 = st1.nextToken();
                                  val19 = st1.nextToken();
                                  val20 = st1.nextToken();
                                  st.executeUpdate("INSERT INTO LANDINGS_HOLD (lh_id, lh_batch, supplier_dr_id, supplier_unique_id, supplier_dealer_id, supplier_cf_id, supplier_vessel_id, unload_year, unload_month, unload_day, state_code, county_code, port_code, itis_code, market, grade, reported_quantity, unit_measure, dollars, lh_loaddt, lh_loadlive, purch_year, purch_month, purch_day)" +
                        "VALUES (0,'"+val0+"','"+val1+"',"+val2+",'"+val3+"','"+val4+"','"+val5+"',"+val6+","+val7+","+val8+",'"+val9+"','"+val10+"','"+val11+"','"+val12+"','"+val13+"','"+val14+"',"+val15+",'"+val16+"',"+val17+",SYSDATE,NULL,"+val18+","+val19+","+val20+")");
                             } // while else end
                        } // parent while end
                        FileReader in = new FileReader(inputFile);
                        FileWriter out = new FileWriter(outputFile);
    int c;
                        while ((c = in.read()) != -1)
                        { out.write((char)c); }
                        in.close();
                        out.close();
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Number of records inserted - "+cnt);
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write("Copied upload file to archive directory");
                        outFile.write(System.getProperty("line.separator"));
                        outFile.write(f+"/"+s[i]+" - Has been removed from upload directory");
                        buff.close();
                        inputFile.delete();
                   } // for end
                   outFile.write(System.getProperty("line.separator"));
                   outFile.write("Upload Complete...NO ERRORS");
                   outFile.write(System.getProperty("line.separator"));
                   outFile.write("*************************************************************");
                   outFile.write(System.getProperty("line.separator"));
                   conn.close();
              } // if end
              else
              { outFile.write("No files to process"); }
              outFile.flush();
              outFile.close();
              } // try end.
              catch(Exception e)
              { FileWriter errFile = new FileWriter("C://RIFIS/log/errfile.txt", true);
              errFile.write(System.getProperty("line.separator"));
              errFile.write("ALERT....ALERT....ALERT");
              errFile.write(System.getProperty("line.separator"));
              errFile.write("Error Occurred in ReadSource.java - RIFIS Upload");
              errFile.write(System.getProperty("line.separator"));
              errFile.write("My Error: " + e);
              errFile.write(System.getProperty("line.separator"));
              errFile.write("*************************************************************");
                   errFile.flush();
                   errFile.close();
              } // catch exception end.
         return "Hello from java";
         } //public msg block
         public ch06_03()

    Since you didn't use code-formatting tags ([ code ] and [ /code ] without the spaces) it's kinda hard to look at it. But I'm sure it DID execute much more than just the return statement - maybe you're not closing a file or db connection, or maybe you're seeing a cached page, so it actually isn't executing ANYTHING on the server (is your browser set to never check for newer pages so it (almost) always returns from cache, for example?)

Maybe you are looking for