----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

I'm using JServ 1.1 on NT 4, JDK 1.2.2

What I've done below is simply place some code within
the 'IsItWorking' servlet to make a URL connection to
Yahoo, retrieve the front page and spit it out. 
Unfortunately, I end up getting this long exception:

[22/02/2000 14:31:12:752 CST]
java.net.ConnectException: Connection refused: no
further information
        at java.net.PlainSocketImpl.socketConnect(Native
Method)
        at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
        at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:125)
        at
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:112)
        at java.net.Socket.<init>(Socket.java:269)
        at java.net.Socket.<init>(Socket.java:98)
        at
sun.net.NetworkClient.doConnect(NetworkClient.java:54)
        at
sun.net.www.http.HttpClient.openServer(HttpClient.java:320)
        at
sun.net.www.http.HttpClient.openServer(HttpClient.java:431)
        at
sun.net.www.http.HttpClient.<init>(HttpClient.java:260)
        at
sun.net.www.http.HttpClient.<init>(HttpClient.java:270)
        at
sun.net.www.http.HttpClient.New(HttpClient.java:282)
        at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:372)
        at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:457)
        at java.net.URL.openStream(URL.java:818)
        at IsItWorking.service(IsItWorking.java, Compiled
Code)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
        at
org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
        at
org.apache.jserv.JServConnection.run(JServConnection.java:188)
        at java.lang.Thread.run(Thread.java:479)

---------- Source code below --------------

import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class IsItWorking extends HttpServlet 
{
    public static final String TITLE = "Yes, It's
working!";
        
    public void service (HttpServletRequest request,
HttpServletResponse response)
        throws ServletException, IOException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        
        URL yahoo = new URL("http://www.yahoo.com/");
        BufferedReader in = new BufferedReader(new
InputStreamReader(yahoo.openStream()));
        StringBuffer yahoostuff = new StringBuffer();
                
        String inputLine = "";
        
        while ((inputLine = in.readLine()) != null)
            yahoostuff.append(inputLine);
        
        in.close();
                
        out.print(yahoostuff);
    }
}


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to