Http get requests fail after a few weeks

All,
I have a get request to a servlet that works for a few weeks, then it will suddenly stop.
I change the code once, works,then it will fail after a few weeks.
I change the code again, works, then it will fail after a few weeks.
Servlet works like: send one request, wait, then send a second.
Here are the last 2 code iterations:
try {
        // Construct data
        String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
        data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
          //String data = "";
        // Send data
        //URL url = new URL("http://localhost:8080/stocks?action=1&date=20080310");
        URL url = new URL("http://localhost:8080/stocks/monitor?action=1&date="+stringDate);
        URLConnection conn = url.openConnection();
        conn.setDoOutput(true);
        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
        wr.write(data);
        wr.flush();
        // Get the response
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        //System.out.println(rd.read());
        String line;
        int count =0;
        while ((line = rd.readLine()) != null) {
            // Process line...
             System.out.println(count + line);
             count++;
        wr.close();
        rd.close();
    } catch (Exception e) {
    try {
        // Construct data
        String data = URLEncoder.encode("key1", "UTF-8") + "=" + URLEncoder.encode("value1", "UTF-8");
        data += "&" + URLEncoder.encode("key2", "UTF-8") + "=" + URLEncoder.encode("value2", "UTF-8");
         //String data = "";
        // Send data
        URL url = new URL("http://localhost:8080/stocks/monitor?action=2");
        URLConnection conn = url.openConnection();
        conn.setDoOutput(true);
        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
        wr.write(data);
        wr.flush();
        // Get the response
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line;
        int count =0;
        while ((line = rd.readLine()) != null) {
            // Process line...
             System.out.println(count + line);
             count++;
        wr.close();
        rd.close();
    } catch (Exception e) {
    }I send this request twice with different params
public static String sendGetRequest(String endpoint, String requestParameters)
String result = null;
if (endpoint.startsWith("http://"))
// Send a GET request to the servlet
try
// Construct data
StringBuffer data = new StringBuffer();
// Send data
String urlStr = endpoint;
if (requestParameters != null && requestParameters.length () > 0)
urlStr += "?" + requestParameters;
URL url = new URL(urlStr);
URLConnection conn = url.openConnection ();
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuffer sb = new StringBuffer();
String line;
while ((line = rd.readLine()) != null)
sb.append(line);
rd.close();
result = sb.toString();
} catch (Exception e)
e.printStackTrace();
return result;
}Any ideas?
Edited by: iketurna on Mar 13, 2008 7:21 AM

You appear to have empty catch blocks. Which means you don't get the error message that would tell you what is failing.
Put in code that logs the exception and the stack trace of the exception. If you can't figure out the error message, post it here.
You should be closing streams in finally statements. Otherwise they might not get closed when there is an error -> you leak descriptors -> you run out of descriptors -> every stream open will fail -> more errors -> more descriptors get leaked -> etc -> everything stops working. Always do it like this:
    WhateverStream out = null;
    try {
        out = ...;
        ...use out...;
    } finally {
        try {
            if (out != null) out.close();
       } catch (IOException e) { ...log it... }
    }

Similar Messages

  • HT4901 My old calendar data gets deleted automatically after a few weeks. How do I stop this from happening?

    why does the calendar data get deleted after a few weeks on the iPhone and the iPad and the Mac Pro?

    On your iOS devices, go to Settings>Mail,Contacts,Calendars>Sync (in the Calendars section) and set this to All Events.
    Not sure about your Mac.  Try going to icloud.com, opening your calendar, clicking on the gear icon on the lower left and choose preferences, then on the Advanced tab make sure you haven't checked Hide Events next to Old Events.

  • I upgraded my iBook G4 from 384MBytes to 640Mbytes and upgraded from Tiger to Leopard. After a few weeks the HDD failed. New Leopard install reports: "insufficient memory". I need Tiger install disks so I can install

    I upgraded my iBook G4 from 384MBytes to 640Mbytes and upgraded from Tiger to Leopard.
    After a few weeks the HDD failed. I bought a new disk, installed it and trued to install Leopard, but the  install fails reporting "insufficient memory".
    I assume the installation requires more memory than the OS actually needs to be able to run.
    I need Tiger install CD/DVD so I can install Tiger first and then upgrade to Leopard.

    Call Apple Customer Support 1-800-767-2775, provide the Serial Number and specifications of the Mac, and for a reasonable fee, they will supply a replacement set of system discs (if available).
    The discs will be for the original version of the OS that was pre-installed when the Mac was manufactured.
    You need much more RAM than that.
    Leopard system requirements:
    http://support.apple.com/kb/SP517

  • Hii all, I just bought an used iphone 5c from an user and only after a few weeks realised that it got activation locked. He might be unaware of that. Is it possible to get back to him and unlock the device for me as i have not contacts with him presently.

    Hii all, I just bought an used iphone 5c from an user and only after a few weeks realised that it got activation locked. He might be unaware of that. Is it possible to get back to him and unlock the device for me as i have not contacts with him presently.

    Well first you need to sync your iPhone 4 with your Mac/PC so that it will transfer all your music, apps, podcasts, etc. Then sync your iPod Touch and the media you selected during the sync should be there on your iPhone. If you have difficulty in transferring media from iPhone to your computer, try softwares like TransCopy. They will help in transferring data from your iphone to your computer. Dont forget to check that all the transferred data is in the iTunes media folder so that the iTunes can locate the files. Link to Transcopy software :
    http://www.copytrans.net/copytrans.php

  • Browser ocassionally opens as pictured below. After a few weeks it will fix itself, but in the meantime, I'm stuck with Chrome, Help!

    Windows 7, Firefox v22.0
    Can't find the browse button referred to in "how to post a screenshot"????
    So I'll try to describe it in a thousand words. It opens stretched vertically so that each section is about 3 times its normal height. Ergo, the bottom is off the page. Uninstalling worked once, but failed a dozen times after that. It will fix itself after a few weeks. Can't find a cause or cure.
    Wish I could paste the screenshot.

    You can't attach a screenshot to the first post that starts a thread, but you can do that in subsequent replies.
    You can try basic steps like these in case of issues with web pages:
    Reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Clear the cache and the cookies from websites that cause problems.
    "Clear the Cache":
    *Firefox/Tools > Options > Advanced > Network > Cached Web Content: "Clear Now"
    "Remove Cookies" from sites causing problems:
    *Firefox/Tools > Options > Privacy > Cookies: "Show Cookies"
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Firefox/Tools > Add-ons > Appearance).
    *Do NOT click the Reset button on the Safe Mode start window or otherwise make changes.
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • HTTP GET request to XI

    hi forum,
    i have been trying to send a HTTP GET request to XI using SOAP and HTTP adpaters (by designing objects in IR and ID), but failed to do so,
    the requirement is specifically sending HTTP GET, (no content in the body)
    Is there any way of achieving this using existing adapters,
    My observations:
    when i make a HTTP GET request to XI using sender HTTP adapter, it gives a response "Body is empty" with HTTP code 204-No content,
    when i use SOAP adapter, and make a HTTP GET request to intergration engine, using sender SOAP adapter, it gives a response
    <html>
    <head>MessageServlet</head>
    <body>
    Message Servlet is in Status OK
    Status information:
    Servlet com.sap.aii.af.mp.soap.web.MessageServlet (Version $Id: //tc/xi/NW04_23_REL/src/_adapters/_soap/java/com/sap/aii/af/mp/soap/web/MessageServlet.java#2 $) bound to /MessageServlet
    <br/>Classname ModuleProcessor: null
    <br/>Lookupname for localModuleProcessorLookupName: localejbs/ModuleProcessorBean
    <br/>Lookupname for remoteModuleProcessorLookupName: null
    <br/>ModuleProcessorClass not instantiated
    <br/>ModuleProcessorLocal is Instance of com.sap.aii.af.mp.processor.ModuleProcessorLocalLocalObjectImpl0_0
    <br/>ModuleProcessorRemote not instantiated
    </body></html>,
    and http response code 200 OK, but i cant find anything in the integration engine (from SXMB_MONI),
    pls help

    hi prateek..... lot of thanks,
    developing/deploying a proxy ejb for this purpose seems good,
    but, deploying a custom servlet (for calling that ejb) seems "not-so-standard" way,
    since i m very new to custom j2ee development in XI, i have certain queries:
    1. Is there any guidelines for developing and deploying custom j2ee components,
    2. Will SAP provide support in case of these components not working "as expected" or hampering other applications,
    thanks for help

  • TS3899 I currently have  live email account but after a few weeks it stops sending me a message to let me know I've got mail. Is there any way this can be sorted as I need notified of mail as it comes in through work. Thanks

    I currently have a live email account, but after a few weeks it stops notifying me that I've got mail. Is there anything I can do as I need notified of incoming mail for work at all times

    I copied text & paisted it and then draged the 3 photos from the file...then clicked on the photo then clicked the inline boxon tool bar nexed to floating one and that is how I did it
    I do not know what you mean "cut & paist"  how do I get the photo in from my picter folder if I do not drag it to the page in Pages? 
    I went to my photo folder and copied a photo and paisted the photo on the top left part of the page and it went there but there was no text to the right of photo...I could crop the photo to what ever size but no text to the right of photo...
    This is just too big of a mess of a program as it should be easier then this,,,I hav e 300 photos in this project and would have to re-paist them all...that is nuts...
    I see the button to the right of inline and floating that has 6 [lace to have the photo but the text does not float around the photo...
    If this is what your talking about this very little freedom in my page layout as I need it to let me place it where I need it to be and the wrap the text...
    There has to be an easier way to get my books ready for other formats other that Apple's iPad...iBooks Author was way eisier to make ready for iTunes...Love that program!!!
    Want my books for sale on all the other formats and was told by Apple Pages whould do it...
    I must be be out to lunch or the designers at Apple are ???

  • Using ADFS authentication to perform SSO via HTTP GET request

    Hi,
    Can i authenticate users (those users are clients, at home) to a web application using ADFS without SAML tokens?
    The situation is that i want the clients to perform SSO to the website via a link they receive in their mailboxes. 
    I thought about a solution that combines JWT in a URL link that each user will get to his private mail. this link will contain the users' claim (such as ID Num, given from AD DS Server dedicated especially for them).
    Thus, the user will receive an email with a link that already contains a short period of time JWT to perform SSO to the webapp.
    Is it possible ? anybody heard about a similar solution ?

    Sandra
    Thanks for your message
    Here is the my requirment
    The basic flow of a Where 2 Get It REST API call is:
    1) create the required XML structure,
    2) URI encode it,
    3) make a HTTP GET request,
    4) then parse the return XML document.
    Currently i have some data in ABAP structure with 5 fields, i need to create XML from the those 5 fields,and needs to be URI
    encode it, and then needs to make a HTTP get request to connect Where to Get It REST API, finally it will return XML document via HTTP Get request , and then needs to convert the return XML to  ABAP structure for further processing .the above 4 points will be implemented in my report.
    Any  body could help on this

  • Can you make a HTTP GET request with JSC form element?

    It seems the form element in JSC make a HTTP POST request by default, but is it possible to make a HTTP GET request by the form element in JSC?
    (It is worth to mention here that HTTP GET request has its distinctive advantages like you can embed the parameters in a URL and bookmark it)
    Thank you very much.

    Jim,
    I am doing the sameway as you suggested to MISS_DUKE
    But have you face any problems in doing so? In otherwords its the page rendering correctly?
    On requesting the same page multiple times, Every time I get the page that was rendered for the first time.
    To see the correct results, I need to close the browser and check it .
    see my previous queries here
    http://swforum.sun.com/jive/thread.jspa?threadID=54379&messageID=208223#208223
    http://swforum.sun.com/jive/thread.jspa?threadID=56440&messageID=214302#214302
    http://swforum.sun.com/jive/thread.jspa?threadID=56676&messageID=214987#214987
    http://swforum.sun.com/jive/thread.jspa?threadID=56390&messageID=214139#214139
    And I am still expecting the answer from experts. But nobody turn arround
    Thanks,
    Sudhakar

  • Why Does CC or Apps in CC become unusable after a few weeks or Months?

    Seem that ever since Adobe has forced many of its users to use CC and CC Apps that they stop working or will not upgrade after a few weeks to a month or two. ADobe needs to fix this really annoying problem that generally requires uninstalling and reinstalling CC and most or all the the apps that are in my cc folder. Come on Adobe own up to it and fix it!!! This has been a problem on Win7, Win8 and nowWin 8.1.
    Thank you, a very annoyed user.

    Can you mention the exact version of InDesign CC that you are using.
    Also can you mention what steps you are performing that makes this issue come up. That will be helpful for us in reproducing the issue internally and investigating it further.
    Regards
    Javed

  • TS3274 when i go into an app,i get kicked out after a few seconds.

    everytime that i try to go into an app,I always get kicked out after a few seconds of being in an app.

    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Or Quit all apps completely and restart the iPad. Go to the home screen first by tapping the home button. Double tap the home button and the task bar will appear with all of your recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar. Restart the iPad.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • I got a new cord to charge my iPhone 5c. After a few weeks it stopped charging sometimes when I do plug it it does not indicate thAt it's charging but the percentage goes up. What do I do? I

    I got a new cord to charge my iPhone 5c. After a few weeks it stopped charging
    sometimes when I do plug it it does not indicate thAt it's charging but the percentage goes up.
    What do I do? I

    First ensure there is no fluff or debris in the charging socket of the iPhone
    Is the new cable a genuine Apple cable ,or a cheap knockoff ?

  • How to auto-delete sent Mails after a few weeks

    Dear community,
    I'd like to delete automatically my sent emails after a few weeks (like the trash folder automatically does after 1 month).
    Is there any option to adjust a setting like this? I already searched for it on icloud.com, my ipad and iphone.
    Thanks in advance for any advice.

    Check Mail/Preferences/Rules to make sure there isn't a rule doing that.

  • Email to TMO BIS user bouncing back after a few weeks

    I'm working with a colleague whose messages to a coworker are bouncing back from her @tmo.blackberry.net address a few weeks after the original message was sent.  The error messages are very generic of the form :
    Subject: Delivery Status Notification(Failure)
    From:  [email protected]
    Date:  Thu, 5 Nov 2009 12:41:43 GMT
    To:  *sender*@georgetown.edu
    Your message:
    To: *recipient*@tmo.blackberry.net
    Subject: TMD departing RESIDENCE
    Sent Date: 26:16 +0000
    has not been delivered to the recipient's BlackBerry Handheld.
    Final-Recipient: RFC822;*recipient*@tmo.blackberry.net
    Action: Failed
    Status: 5.0.0
    Any idea what could be causing this?  It isn't consistent; the recipient receives a lot of other email at her @tmo.blackberry.net address.  The sender is sending from a different BlackBerry on a BES server, but this was also happening when he was also using a TMO BIS account.

    Quite honestly I would tell the recipient to get a free Gmail account and quit using the tmo.blackberry.net account.
    Several reasons, the tmo.blackberry.net account has not spam filters or controls, and it has no webmail viewing (if the device is lost, all the emails are lost).
    But to answer your question, no idea. It could be an odd glitch or burp in the system from a recent BIS server downtime. It could have been delivered anyway.
    Good luck.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • SQL Azure sync service-- absurdly slow and fails after a few days

    Hello. We have been trying to use Azure Data Sync to replicate an on-premise MSSQL database to an SQL Azure database for read-only access by a customer. This was working for a while, but stopped syncing after a couple months(12hr auto-sync schedule) with
    no errors in the log. I had to re-create the sync group, but now it takes even longer than originally to try to sync, and never actually completes, as it gets interrupted by bi-weekly server restarts... It used to take a few hours to sync the new data in our
    database(which is appended to daily)-- but this time it fails after 4+ days... It was unacceptably slow initially(IMO), but now it's clearly unusable.  The original initialization of the data when I first set it up was less than 2 days of syncing. 
    It seems there is a throttle on the Azure sync service. Is this true?  Would it be best to clear the SQL Azure database now and re-sync? Is there a way to pre-load the SQL Azure database with MSSQL on-premise data via a SQL backup file or something?
    Please advise. Thank you.

    when you re-created the sync group, does the member databases/hub database have pre-existing data?
    when synching a sync group for the first time, make sure databases don't contain the same set of data, otherwise, you will run into conflicts which will completely slow down your sync...
    I deleted the initial sync group because it wasn't syncing(auto or on-demand), nor creating a log entry with an error indicating why.
    So, I simply deleted the sync group and re-created it with the same exact databases and settings. I did not delete all data in the SQL Azure database-- I was under the assumption that the sync service, with the tracking tables were smart enough to not get
    confused with pre-existing data, but apparently that's not how this works?
    I obviously can't delete the data in the source database(MSSQL on-premise), but I could delete the tables in the SQL Azure database if that's supposed to fix the problem-- then we'll just have to wait multiple days for it to be completely re-initialized,
    hopefully without error... Is there a way to seed the data in some way to prevent this extremely log first sync?
    Thank you for your help.

Maybe you are looking for

  • IPod nano 6th gen won't play my music.

    My iPod nano 6th gen has worked fine for years and when I synced it recently it would play some tunes fine, cut some off mid-way through and skip some completely. The first thing I done was just tried to sync it again but this didn't make a differenc

  • REUSE_ALV_GRID_DISPLAY (column headings from ALV to EXCEL) Max please help

    Hi Max, If you remember in one of my last post I asked for changing the column headings in ALV display for example from 'Material' to 'Material used'. I am using CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'    EXPORTING       I_CALLBACK_PROGRAM            

  • Bom Explosion first level, if first level having phanthom it has to explode

    Dear All, Kindly tell any function module is available for BOM explosion first level. if first level having any sub assembly part, bom not to explode below level. if first level having any phanthom material, it has to explode below level, in this pha

  • More CD-ROM Problems

    Alright, This is great, how many more problems could this computer possibly have? My CD Rom drive is messed up now. About a week ago, it decided it didn't want to burn a CD with more then 6 songs on it via iTunes. I called Apple Care, we deleted Cach

  • User exit to get pop-up in co09

    hello, i have a question. is there an user exit to get a pop-up in co09? we don't wanna check availability in order. we only want check material status in co09. thanks a lot best regards