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 !
pravin_tiwariAsked:
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.

Ravindra76Commented:
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

http://yoursite/servlet/YourServletName

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

http://yoursite:servletport/servlet/YourServletName.

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



0
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 202.54.20.85//servlet/RCServlet.

my code snipplet is:

        public void getData() {
             try {
                   System.out.println("String ==> " +input);
                   URL connect = new URL("http://202.54.20.85:8081/servlet/RCServlet");
                   URLConnection c = connect.openConnection();
                   System.out.println(" just after url connection ");
                   c.setDoInput(true);
                   c.setDoOutput(true);
                   OutputStream os = c.getOutputStream();
                   ObjectOutputStream oos = new ObjectOutputStream(os);
                   oos.writeObject(input);
                   oos.close();
                   os.close();
}



thanks very much for your assistance!
0
Ravindra76Commented:
>>>

FileNotFound 202.54.20.85//servlet/RCServlet.

Hi,

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
0
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.

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

check out for any exception at server side.  

0

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
prats_srCommented:

 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.
0
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.





0
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.