Slow response using HttpURLConnection in Weblogic 9.2


XML & Web services: Slow response using HttpURLConnection in Weblogic 9.2

  1. I have some problems with Weblogic 9.2. I have a session bean that calls upon a XML file from another server and returns the XML String. The code is something as below. When I run the code below as a java class, it returns the results almost immediately. But when I run it as a method in the bean, it starts, hangs for about 15 secs, then returns the results. I tried using web services and this also happens. It also hangs about 15 seconds before a response is obtained. By the way, the same code used to return the results immediately in Weblogic 8.14. Why is this so? Can someone help? The code is something like this: public void getXML() throws Exception { URL xml = new URL(""); // URLConnection yc = xml.openConnection(); HttpURLConnection yc = (HttpURLConnection) xml.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } }
  2. Same problem[ Go to top ]

    hy, I'm having nearly the same problem. Did you already solve it? Thanks regards
  3. Just wondering if any resolution to this issue had been found? I have run into a similar issue after upgrading from Weblogic 8.1 to Weblogic 9.2. Basically, I am running the same code as documented above, except in my case, the 1st time I access a URL resource, it comes back immediately, but if I access the same URL resource again (within 15 seconds), the input stream throws and EOFException (End of File exception). It appears to always fail on the 2nd call if it is made to the same resource within 15 seconds. The EOFException occurs right at, most likely because it gave me the already used input stream from the 1st call. private byte[] callReportUrl(String url) throws Exception { ByteArrayOutputStream baos = new ByteArrayOutputStream(); HttpURLConnection connection = (HttpURLConnection)new URL(url).openConnection(); InputStream is = connection.getInputStream(); int i = -1, while((i = != -1) { baos.write(i); } is.close(); return baos.toByteArray(); } }