"Elina M�kel�" wrote:

> Hello all,
>
> Can anybody help with servlets and OutputStream !
> I have a following  code in my servlet which gives an exception.
>  If I test this servlet in my own machine with servletrunner it is OK.
> But when I move this servlet to our server ( NT4, Netscape Enterprise
> Server, JRun 2.3) it gives
> an error message. URLConnection objects can be created, but getOutputStream
> gives the
> exception. Must I do some JRun administration tasks?
>
> URLConnection connectionToURL;
> OutputStream os;
> URL remoteFile;
> try {
>   remoteFile = new URL("http://www.xxx.yyy/servlet/servletname");
>   connectionToURL = remoteFile.openConnection(); //THIS IS OK
>   connectionToURL.setDoOutput(true);
>   connectionToURL.setDoInput(true);

Add a line here:

        connectionToURL.connect();

I don't know why it works on your own machine without this -- it's not
supposed to.  See the API docs for URLConnection for more information, or the
networking trail in the Java Language Tutorial
(http://java.sun.com/docs/books/tutorial).

>
>   os = connectionToURL.getOutputStream(); //ERROR MESSAGE: Connection
> refused: no further information
>
> }
> catch (Exception e) {
>  return e.getMessage();
> }
> return "OK";
>
> Thanks and Best Regards,
> Elina
>

Craig McClanahan

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to