Hi, this is my first post and I'm killing myself trying to resolve this.  I
hope someone can shed some light...

I've got a JSP and I'm simply trying to connect to an external URL from
behind our corporate firewall going through a proxy.  The reason I'm so
confused is this works flawlessly with Jrun4, but I'm porting it over to
Tomcat 5.5.15 (yay!).

Jrun and Tomcat are on the same machine and are using jre1.5.0_06.  The
Tomcat install is pretty much default but I've configured mod_jk for use
with Apache.  I receive the same error whether I connect through Apache or
directly to Tomcat via port 8080.

My test code is below - I've changed domain names to protect the innocent.

---------------

Properties systemSettings = System.getProperties();
systemSettings.put("http.proxyHost","my.proxyserver.com");
systemSettings.put("http.proxyPort","8080");
System.setProperties(systemSettings);

URL writerURL = new URL("http://api.yellowbrix.com/api/?query=something";);
URLConnection connection = writerURL.openConnection();

// dump url contents to screen for testing
BufferedReader in = new BufferedReader(new
InputStreamReader(connection.getInputStream()));
String inputLine;

while ((inputLine = in.readLine()) != null)
        out.println(inputLine+"<br />");

in.close();

---------------

And the error:

java.io.IOException: Server returned HTTP response code: 502 for URL:
http://api.yellowbrix.com/api/?query=something
        sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown 
Source)
        
org.apache.jsp.testproxy_jsp._jspService(org.apache.jsp.testproxy_jsp:78)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Thanks,
Trent
--
View this message in context: 
http://www.nabble.com/Bad-gateway-502-error-trying-to-reach-external-URL-through-proxy-t1402806.html#a3775342
Sent from the Tomcat - User forum at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to