aspose file tools*
The moose likes Java in General and the fly likes Getting 502 error when opening URLConnection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Getting 502 error when opening URLConnection" Watch "Getting 502 error when opening URLConnection" New topic
Author

Getting 502 error when opening URLConnection

Sean Chang
Greenhorn

Joined: Feb 12, 2009
Posts: 12
Hi,

I've been trying to open a URLConnection in from a servlet running on Websphere, every time I try to connect via the servlet I get this error, can anyone advise why this is happening? I am able to copy/past this servlet in a browser and it at least get's accessed, as well as on the command line on my local machine (this is running on a server, and trying to connect to another server):

Exception inside URL Connection
java.io.IOException: Server returned HTTP response code: 502 for URL: http://XXX:9080/sso-reg/servlets/sso/app/SSOLogoutServlet?paramObj=aced00057372001d636f6d2e736f6674656f6e2e73736f2e55524c506172616d6574657273f7439f0669cbd72002000a4c000866726d4c6f67696e7400124c6a6176612f6c616e672f537472696e673b4c000870617373776f726471007e00014c000a7265666572657255726c71007e00014c000d7265717565737453746174757371007e00014c000b726571756573745479706571007e00014c000c72657365744d65737361676571007e00014c000873736f417070496471007e00014c0005746f6b656e71007e00014c000675736572496471007e00014c00117573657250726f66696c654f626a6563747400234c636f6d2f736f6674656f6e2f73736f2f5573657250726f66696c654f626a6563743b787074000071007e000471007e000471007e000471007e000471007e000471007e000471007e000474000a4a54415254414d4f534170
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1178)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderFieldKey(HttpURLConnection.java:1948)
at com.softeon.eso.pwishared.csr.login.actions.SSOLoginAction.ssoLogout(SSOLoginAction.java:420)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at com.softeon.eso.shared.service.ESORequestProcessor.process(ESORequestProcessor.java:38)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1146)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1087)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:145)
at com.link.oscar.view.framework.filter.AbsoluteSendRedirectFilter.doFilter(Unknown Source)
at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:190)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:130)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain._doFilter(WebAppFilterChain.java:87)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:837)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:680)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:588)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:525)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:90)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:751)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1478)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:126)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:458)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:387)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:267)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:196)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:751)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:881)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)

Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18886
    
    8

You should very easily be able to find out what HTTP status code 502 means, with a web search. Here's what I got from the Wikipedia page about HTTP status codes:
Wikipedia wrote:502 Bad Gateway
The server was acting as a gateway or proxy and received an invalid response from the upstream server.

So, there's a problem with the server. That problem may or may not have something to do with the request you sent, but the only way to find that out would be to look at the server and see what happened.
 
 
subject: Getting 502 error when opening URLConnection