• 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 !
0
pravin_tiwari
Asked:
pravin_tiwari
1 Solution
 
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
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.

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

check out for any exception at server side.  

0
 
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

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