Server returned HTTP response code: 500.. i need help
i have this applet that communicates with a servlet.. when the applet connects to the servlet, i get the Server returned HTTP response code: 500 error.. when i am testing in my own pc, everything is fine.. when i tried deploying it in a server, the error occurs.. i do not have any idea what is wrong.. please help
[321 byte] By [
hardcodera] at [2007-11-27 10:10:37]

# 1
i get the error in this line in my applet:
inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
this is the method that conatins the line above:
protected String myMethod(String fileName) {
String doc = null;
ObjectInputStream inputFromServlet = null;
try {
//URL studentDBservlet = new URL( servletGET );
URL studentDBservlet = new URL(this.getCodeBase(), "myServlet?action=load&fileName=" + fileName);
URLConnection servletConnection = studentDBservlet.openConnection();
inputFromServlet = new ObjectInputStream(servletConnection.getInputStream());
doc = (String)inputFromServlet.readObject();
inputFromServlet.close();
}
catch (Exception e) {
e.printStackTrace();
}
return doc;
}
# 2
another question.. is it required to sign the applet when doing an applet servlet communication? if yes, is there a free, easy way of doing this?
# 3
An applet can open a connection back to server that it originated from but the url address much match exactly. If you open the Applet page using the url http://localhost the Applet can not open a connection to the server using http;//127.0.0.1.
Sun provides instructions for signing an Applet.
# 4
i already checked the url.. i got the codebase of the applet and send it to the servlet.. so do i have to sign the applet for my web app to work?
# 5
Can u put the Trace of the response code: 500, it will help to find exact error
# 6
sir, what do you mean by trace?
here is what i got from the java console..
java.io.IOException: Server returned HTTP response code: 500 for URL: http://mental_boi.s46.eatj.com/myServlet/loadMap?action=load&fileName=http://mental_boi.s46.eatj.com/CityNavigator/mapSpain.svg
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at edu.citynavigator.map.editor.MapEditor.loadMap(MapEditor.java:685)
at edu.citynavigator.map.editor.MapEditor.init(MapEditor.java:130)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at java.io.StringReader.<init>(Unknown Source)
at edu.citynavigator.map.editor.MapEditor.stringToSVG(MapEditor.java:703)
at edu.citynavigator.map.editor.MapEditor.init(MapEditor.java:131)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
and does the applet have to be signed?
Message was edited by:
hardcoder
# 8
update..
i installed jdk 1.5 and compiled my code using it and now i get the error even at the localhost.. please help me!
# 9
Internal Error 500
The server encountered an unexpected condition which prevented it from fulfilling the request
http://www.w3.org/Protocols/HTTP/HTRESP.html
This tells me that the Applet was able to successfully connect to the server and send an HTTP request but that the Servlet/JSP was unable to successfully process the request. So I would say look on the server for the problem.
And no you do not need to sign an Applet to open a connection back to the originating server.