• Post Reply Bookmark Topic Watch Topic
  • New Topic

Applet can't find Servlet file  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing an applet that uses servlets to access files on the server (which is a unix machine). The first servlet executes fine (It is used to get default information for the client to manipulate), but the next servlet to be called throws a File Not Found Exception even though it is located in the same directory as the first Servlet. The path name of the file it is looking for is spelled correctly.

these are the objects used in the code shown below
webServerStr -- String
MapServlet -- URL
serConn -- URLConnection
out -- ObjectOutputStream
in -- ObjectInputStream
location -- MapURL (object that gets returned from Servlet)
ma -- MapAttributes (object that gets sent to Servlet)

this is in the try portion of the code that calls the Servlet that throws the File Not Found Exception:
webServerStr = "http://phish.census.gov/servlet/MapServlet";

MapServlet = new URL(webServerStr);
servCon = MapServlet.openConnection();
out = new ObjectOutputStream(servCon.getOutputStream());

in = new ObjectInputStream(servCon.getInputStream());
location = (MapURL)in.readObject();
the servlet that runs correctly is called using the exact same code as above except MapServlet is called DefaultServlet (for URL Object as well as filename in webServerStr) and the objects sent and returned are different. Both Servlets also have the same permission set for them - R & W for owner and R for the rest.
The actual error recieved is this:
java.io.FileNotFoundException: http://phish.census.gov/servlet/MapServlet at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLCon
changing the URL to servlets/MapServlet still gives me the same error:
java.io.FileNotFoundException: http://phish.census.gov/servlets/MapServlet
If anyone knows what's wrong or can give me any ideas as to why this is happening it would really be appreciated.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!