You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by DENIZ DEMIR <de...@yfas.com.tr> on 2001/06/28 13:23:28 UTC

Applet-Servlet commuinication (url socket)

Hi,

I have written a servlet and an applet, the applet opens an url socket to
the servlet which loads the applet. I have tested my servlet-applet with
JavaWeb Server and it works, but when I tried to run the servlet with
apache-tomcat, my web server run the servlet and it loads the applet, but
when applet tries to open the url connection to the servlet, it gives the
following exception.

java.io.FileNotFoundException: http://www.yfas.com.tr/servlet/servlet/Login
 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown
Source)
 at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream(Unknown
Source)
 at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown
Source)
 at
sun.plugin.protocol.jdk12.http.HttpURLConnection.checkCookieHeader(Unknown
Source)
 at sun.plugin.protocol.jdk12.http.HttpURLConnection.getInputStream(Unknown
Source)
 at LoginApplet.validateUser(LoginApplet.java:238)
 at LoginApplet.handleEvent(LoginApplet.java:133)
 at java.awt.Component.postEvent(Unknown Source)
 at java.awt.Component.postEvent(Unknown Source)
 at java.awt.Component.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)

The codes in the applet to connect the servlet is as follows:

      String urlString = "http://" + getDocumentBase().getHost() +
"/servlet/servlet/Login";
      java.net.URL url = new java.net.URL(urlString);

I want to wonder that tomcat whether loads the Login servlet at startup, I
have added the following entry into web.xml file:

<servlet>
     <servlet-name>Login</servlet-name>
     <servlet-class>LoginServlet</servlet-class>
     <load-on-startup>1</load-on-startup>
</servlet>

Is there any mistake in the url of the servlet? I have written the url of
the servlet in the address bar of the browser as
http://www.yfas.com.tr/servlet/servlet/Login and the servlet runs, so, I
have written this address into the appet as indicated above.

Is there any idea?

Deniz...