Thanks for your response.
I have tried it with and without a package. This code is the most recent
and the servlet is compiled wiothout a package. It is accessed with the
browser by exactly this url
"http://192.168.0.5:8080/servlet/HelloServlet" but does not work using
this url and code in a java application. If I change the URL it
exceptions which implies that it is the right url but somehow doesnt
activate the servlet???
Cory Wandling wrote:
>
> HelloServlet needs a package name. It must be fully qualified. I doubt
> that it is in the default package.
>
> ----- Original Message -----
> From: "Mark Lintner" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Friday, July 21, 2000 10:36 PM
> Subject: Calling servlet from java application
>
> > Im using this code to call a servlet on another machine that runs
> > tomcat.
> >
> > void sendData(String s)throws Exception{
> > URL servlet= new
> RL( "http://192.168.0.5:8080/servlet/HelloServlet" );
> > URLConnection servletConnection = servlet.openConnection();
> >
> > servletConnection.setDoInput(true);
> > servletConnection.setDoOutput(true);
> > servletConnection.setUseCaches (false);
> > servletConnection.setDefaultUseCaches (false);
> > servletConnection.setRequestProperty ("Content-Type",
> > "application/octet-stream");
> > ObjectOutputStream outputToServlet = new
> > ObjectOutputStream(servletConnection.getOutputStream());
> > Permission p = servletConnection.getPermission();
> > outputToServlet.writeObject(s);
> >
> > String ss = servletConnection.toString();
> > outputToServlet.flush();
> > outputToServlet.close();
> > }
> >
> > This url "http://192.168.0.5:8080/servlet/HelloServlet" brings a
> > response from the browser. The servlet is expected to respond to doGet
> > method. I have searched books, web info and tomcat docs. The application
> > that sends the data does not exception. Why doesnt this work???
> >
> >
> ___________________________________________________________________________
> > 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
>
> ___________________________________________________________________________
> 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
___________________________________________________________________________
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