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 !
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

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

check out for any exception at server side.  


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

 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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.