Service method  of servlet  is called repetitively as response time is more

Problem: when we try to retrieve data for a particular input, then the retrieve
query takes longer time which is as expected i.e more than five minutes as our data ware house is large and the where clause is very complex. After 5 mins what happens is that the service
method in the servlet call is made again and so the retrieve process as if it was
triggered again,where as no one has triggered it. This happens every 5 mins and the overall
process hangs forever.pl help if any answer
thanks in adv.
M.S.Chandrasekhar

Hi ,
Hello ,
Try this code ,
Class classObject = Class.forName("SecondServlet");
SecondServlet servlet = (SecondServlet)classObject.newInstance();
servlet.init(getServletConfig());
System.out.println("Before calling the service() from TestServlet");
servlet.service(req,res);
servlet.destroy();
Regards ,
Venkat

Similar Messages

  • Service method of servlet is called repeatedly by 9ias

    Problem: when we try to retrieve data for a particular input, then the retrieve
    query takes longer time which is as expected i.e more than five minutes as our data ware house is large and the where clause is very complex. After 5 mins what happens is that the service
    method in the servlet call is made again and so the retrieve process as if it was
    triggered again,where as no one has triggered it. This happens every 5 mins and the overall
    process hangs forever.pl help if any answer
    thanks in adv.
    M.S.Chandrasekhar

    Hi MS,
    My guess (and it can only be a guess, I'm afraid, based on the [lack
    of] information you have supplied) is that you are hitting some sort
    of timeout value, which is determined by a setting in one of your
    configuration files.
    So as Prasad has already mentioned, more information would help us
    to help you.
    Good Luck,
    Avi.

  • Disadvantages of Overriding service() method in servlets?

    Hi,
    Could you please tell me what are the possible disadvantages of overriding service() method in the servlets?

    If there is some business logic in the service() itself? without the control being transferred to doGet() nor doPost()?
    then what might be the disadvantages of overriding service()But there isn't any business logic in the service() method itself, unless you override it. You are going around in circles here. This is making no sense at all.

  • Global object services: Method EXECUTE is not called

    Hi all,
    I implemented a new GOS service and therefore inherited the standard class CL_GOS_SERVICE and redefined the methods CHECK_STATUS and EXECUTE. I also made the entry in table SGOSATTR.
    When I test my new service, the CHECK_STATUS method is called and its ep_status is set to mp_status_active. Everything fine!
    But when I click the appeared menu entry (or service icon) nothing happens. The screen is repainted, nothing more. There is no exception or anything else.
    Does anyone as an idea?
    If you need further information, please let me know.
    Thanks for your help.
    Kind regards,
    Thomas

    Hello Thomas
    Perhaps the answers in thread
    New service in GOS - How to?
    may be helpful.
    Regards
      Uwe

  • Query response time takes more time when calling from package

    SELECT
    /* UTILITIES_PKG.GET_COUNTRY_CODE(E.EMP_ID,E.EMP_NO) COUNTRY_ID */
    (SELECT DISTINCT IE.COUNTRY_ID
    FROM DOCUMENT IE
    WHERE IE.EMP_ID =E.EMP_ID
    AND IE.EMP_NO = E.EMP_NO
    AND IE.STATUS = 'OPEN' ) COUNTRY_ID
    FROM EMPLOYEE E
    CREATE OR REPLACE PACKAGE BODY UTILITIES_PKG AS
    FUNCTION GET_COUNTRY_CODE(P_EMP_ID IN VARCHAR2, P_EMP_NO IN VARCHAR2)
    RETURN VARCHAR2 IS
    L_COUNTRY_ID VARCHAR2(25) := '';
    BEGIN
    SELECT DISTINCT IE.COUNTRY_ID
    INTO L_COUNTRY_ID
    FROM DOCUMENT IE
    WHERE IE.EMP_ID = P_EMP_ID
    AND IE.EMP_NO = P_EMP_NO
    AND IE.STATUS = 'OPEN';
    RETURN L_COUNTRY_ID;
    EXCEPTION
    WHEN OTHERS THEN
    RETURN 'CONT';
    END;
    END UTILITIES_PKG;
    when I run above query its coming in 1.2 seconds.but when comment subquery and call from package its taking 9 seconds.query returns more than 2000 records.i am not able to find the reason why it is taking more time when calling from package?

    You are getting a different plan when you run it as PL/SQL most likely. Comment your statement:
    SELECT /* your comment here */then find them in V$SQL and get the SQL IDs. You can then use DBMS_XPLAN.DISPLAY_CURSOR to see what is actually happening.
    http://www.psoug.org/reference/dbms_xplan.html

  • DoGet() and service() method differences in servlets

    can you give the differences between doGet() and service() methods in servlets. where to use doGet() and where to use service()
    thanks

    service() is called whenever the Servlet gets a HTTP request. Per default it calls the correct do<METHOD>() method.
    So doGet() is only called when you get a GET request via HTTP. For POST (for example) doPost() will be called instead.

  • URGENT: Getting app module service method result and calling web service??

    We have a .jar from another vendor that allows us to interact with an FOP rendering process. This .jar has methods that allow us to pass several parameters which results in the creation of the PDF which is stored in the database.
    We need to create the XML, which we've done, via view objects and a method in our application module. The developers at this point, have placed the code to call the service method into the model code that generates the XML. The actual .jar file for this is in the viewcontroller area.
    Is this a "reasonable" approach? ( that is, importing view object jar in model)
    The web service needs to have several parameters sent to it, most of which are configured in the web.xml. They are now being passed via a data action to the model's service method.
    Shouldn't the data action be written more like the following - note: some questions in here as well...
    public void onShowPdf( DataActionContext ctx )
    // note, you can get here from 5 different places in the application and we need to be able to retrieve the bindings from these separate places for proper generation... how??
    AppModule am = (AppModule) getAm();
    String strXML = am.getXML(...);
    // get web.xml values from session context...
    PDFArchiver stub = new PDFArchiver();
    stub.generate( send prms here );
    // the next page just needs to have 3 of the parameters exposed from this page to yield the results of the generated pdf (retrieve from db)
    // what would be the best way to get the parameters over there?
    } // onShowPDF
    after this data action, it simply forwards to the next page, which has a frame to display the pdf with an [ok] button at the bottom. The pdf is rendered via a Servlet.
    one last question...
    Right now, the service method was dropped on the data action, and it is automatically invoked ( we've bound the 8 parameters to it by over-riding initializeMethodParameters). If we were to switch it so the method RETURNED the XML, how would we get the results back while INSIDE A DATA ACTION? I could see if we called it by invoking a service method from the app module instance, but how do you do it in the lifecycle of the data action??
    Whew, that's all the questions for now.
    Any help, again, would be GREATLY appreciated.

    Most of the items in this previous post have been addressed. The one problem that remains is that we use a servlet to display the PDF. The servlet reads 3 parameters from the URL to send to a service method that reads and streams the PDF to the browser.
    HOWEVER, the user can view source and then paste parameters into the URL and view whatever he wants. So:
    1. How can we prevent the servlet parameters from being seen inside the source? OR, how can we simply prevent the user from invoking the view pdf servlet with other parameters?
    2. We've temporarily, written a data action (displayPDF) which has no service method. In the findForward data action, we grab the bindings that the servlet needs from other pages (4 different binding containers), then invoke the service method and write the data to the response object. This seems to work. So, our page has an iframe with the src="displayPDF.do".
    Again, should this be done another way? Seems strange to have a data action that "acts like a servlet"...
    Thanks for feedback.

  • Overriding doPost() better than service() method

    why overriding doPost() or doGet() is better than service() method
    in servlets
    thanx

    One reason is to help break your code up into more manageable pieces. For example, let's say you have a page that displays a list of Employees when called via GET, but also includes a FORM that lets you delete employees based on checkboxes included on the form with a SUBMIT button. If you use the doService, you'll probably have to do something like this:
    doService(request, response) {
      if (request.getMethod().equals("get")) {
        // handle GET logic
      else {
        //  handle POST logic
    }However, if you have two separate methods, it makes the logic a little simpler. For example:
    doGet(request, response) {
      // handle GET logic
    doPost(request, response) {
      // handle POST logic
    }The distinction is fairly minor, but I do think the code is cleaner without having to check for gets and posts. With that said, I have plenty of servlets that use the doService() method because there is no distinction in those servlets between the doGet() and doPost() functionality.
    Michael

  • Calling Web Service Methods in  Web Dynpro

    1. Created a Bean with get & set methods..Created a portal Service around it
    2. Created a Web Service and checked the same using EP Web Checker
    3. Created a Web Dynpro app having two screens (First one for setting String value and second  for getting string value)
    4. Configured the Web Service in the model...I can see the Request and Response in the Context...Mapped the request to first view and Response to Second View
    How do I call the Web Service method to Set the Paramter and how do I extract the value from the response?
    Rgds

    Hello Gulshan,
    Did you check this:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on accessing an email web service - 6_0_.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on accessing the car rental web service - 7.htm
    Best regards, Maksim Rashchynski.

  • Why Do We Have To Call super.init(config); in init() method of servlet?

    Hi, everyone..
    I wonder why we call super.init(config) in init method of servlet... If i dont call it ; when i try to get servletcontext in service method it throws java.lang.NullPointerException...when we call super.init() , what is happening behind the scene? If anybody has a technical explanation for my question , i will be very pleased...
    THX FOR YOUR FUTURE REPLIES IN ADVANCE....

    I am sorry about the uppercases and i dont want to seem smart on java forums... Anyway, m8 this is the thing that i know... i meant; for instance when we override doGet or doPost method ; we dont need to override init method; but the server loads the servlet and we can get the context of the servlet in these methods easily by calling getServletContext() method; however when we want to call service method implicitly by jndi, servlet needs to be loaded and init method must call its parent...(i also write down in web.xml <load-on-startup>.... for that servlet).
    thx for your replies in advance....

  • Can we have more than one service method in a single servlet

    can we have more than one service method in a single servlet?explain with example

    No, you can only have one service method. However, you can have it process two different requests as follows.
    Lets say you have two JSP pages. Put a hidden text value in one called jsp1 and a hiddent text value in the other called jsp2 (example: <input type="hidden" name="jspPage" value="jsp1"> and <input type="hidden" name="jspPage" value="jsp2">.
    Then in your service method, read in request.getParameter("jspPage") to determine if its jsp1 or jsp2 and call up the appropriate logic to process them separately.

  • Service method in javax.servlet.http.HttpServlet

    Hi All,
    I have a doubt in the service method of javax.servlet.http.HttpServlet
    There are two service methods in the javax.servlet.http.HttpServlet.
    one is with protected and other is with public access specifier.
    In the javadoc it is said that public service method dispatches client requests to the protected service method.
    Why this type of design is required.
    Instead of having a two service methods, Is it not possible to have a single service method and attain the functionality intended.
    Are there any advantages by having two service methods.
    I think there may be some idea/functionality behind these for having two service methods , which I am not able to understand.
    Would be greatful , if someone can throw light on this .
    Thanks,
    Dhanasekaran.

    This is just a theory, but here goes:
    The public service() method takes arguments of ServletRequest and ServletResponse, presumably because that's the signature that the non-HTTP specific servlet engine requires.
    The protected service() method of HttpServlet takes arguments of HttpServletRequest and HttpServletResponse and includes HTTP specific functions.
    My guess is that the public service() method either casts the arguments to the Http objects or does work to create the Http objects before calling the protected method.

  • Calling destroy()  in service() method

    hi,
    can we call destroy() method in service() method of servlets

    It is possible, but you should not. The destroy() method is used by the servlet container as a signal that the servlet is being taken out of service. If you call destroy yourself, you could be setting your servlet into an inconsistant state. Calling destroy() does not make the container take the servlet out of service.

  • Servlets service method....

    Hello friends can anyone guide me about servlets service method.
    I know it is called internally by container but how ? How container works to call service
    method.
    thanks ..

    thanks for the above two replies. Yes I am aware of these facts. But what i want to know is for my knowledge, Does jsp container or servlet container implement any class that in turn calls the service method of our class passing them request and response object. As request and response are the interfaces, they only define certain methods leaving implementation of these methods for the container. My question is how they might be implementing those methods and then calling the service method passing them those objects. I will print one example that i created so that you guys will have some idea of my query.
    // Take this as the HttpServletRequest interface. Reference of this interface should be passed
    //to the user-defined class's method.
    interface ServletRequestInterface
         public String getName();
    // The class implementing the above interface
    class Test implements ServletRequestInterface
         ServletRequestInterface a=null;
         public String getName(){
         return "Hi";
         Test(){setServletRequestInterface();}
         public void setServletRequestInterface()
              a= this;
         public ServletRequestInterface getServletRequestInterface()
              return a;
    //the class actually making use of the above interface but still it is not ready to pass it to some user
    //defined method. How can we do it or is probably handled in container.
    public class ServletContainer
         public static void main(String args[])
              Test t = new Test();
              System.out.println(t.getServletRequestInterface().getName());
    This will print hi. Now if i want to pass this ServletRequestInterface to user-defined methods, how will i pass it automatically.

  • Calling a method of servlet

    How to call a method of servlets like we do in struts like "get.do?method=getData". I know servlets are called defacult method either dopost or doget are called but can i call any other in the servlet and if yes how can i do that?

    May be your servlet is not able to lookup the EJB. You can use some print statements and see whether lookup ok or not.
    Just a guess.
    Plese get back, if any queries.
    Thanks,
    Rakesh.

Maybe you are looking for