• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 409
  • Last Modified:

applet to servlet communication

my applet is making a URL connection to the servlet. now the problem is when i publish in the web applet doesn't get the servlet and i get a exception at the applet end as : FileNotFound Exception. even the url is proper as i use to work before and suddenly it has started throwing exception
help !
1 Solution
Hi pravin_tiwari

1. First check the port on which your applet is running and the port on which servlet is running.

If there are samw port your url will like this


2.If they are running on different port, you have to mention port on ehich servlet is running.


In my view, your problem is applet and servlet are running on different port.

IF they are running on same port are you mentioned the port as in 2 above,

Just post stacktrace and

the code which actually connecting with servlet

pravin_tiwariAuthor Commented:
hi ravindra76,
   well as you have mentioned in your comment we are using the second option. the funny thing is it was working few days back but now suddenly it is giving an exception : FileNotFound

my code snipplet is:

        public void getData() {
             try {
                   System.out.println("String ==> " +input);
                   URL connect = new URL("");
                   URLConnection c = connect.openConnection();
                   System.out.println(" just after url connection ");
                   OutputStream os = c.getOutputStream();
                   ObjectOutputStream oos = new ObjectOutputStream(os);

thanks very much for your assistance!



Here port 8081 is missing in stack trace.

If you don't laugh at cheap trick,

compile Applet and Servlet file once recently and restart the server which is running the servlet

Best of luck
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tell me whether the request is going to the servlet or not.

check out for any exception at server side.  


 Have U checked Ur classpath settings.
U say published the applet, so I assume
it is a different m/c.Could be that
the classpath was set wrongly on the server m/c and U were able to access the servlet becos' U had a local copy
on Ur hard disk.
pravin_tiwariAuthor Commented:
hi all,
    thanks for your valuable comments...finally i got the solution and it was that my servlet was throwing an error. but since i was calling the function of the applet that establishes the stream with servlet from java script i was getting filenotfound exception.
i think chintal stud is write.

thanks to all anyway.


Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now