dcsimg
Error HTTP 503 on a tomcat in a case but not in the other one, on the same server.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   loucs_mesh
Posted On:   Monday, December 15, 2008 11:35 AM

Hi all, I have a tomcat webapp on witch i'm getting informations from other webapps. On my machine, i can pick the info without any problems. (tomcat 5.5.22 and JRE 1.5.0_12) On a test server (tomcat 5.5.17 and JRE 1.5.0_08), which contains the same webapp (the client one), the same code get an error 503 "service unavailable". On this last server, I wrote a java standalone app, re-using the exact same code as my webapp, to pick the info. I got no problems getting the info from the standalone app. Here are errors i get when my code receive a 503 error : MOTORCRAFT | 12/12/08 18:40:07 [recuperationDerniereInformationReseau() @ Information.java] http://demo5.etai.fr:8080/SE   More>>

Hi all,

I have a tomcat webapp on witch i'm getting informations from other webapps.

On my machine, i can pick the info without any problems. (tomcat 5.5.22 and JRE 1.5.0_12)

On a test server (tomcat 5.5.17 and JRE 1.5.0_08), which contains the same webapp (the client one), the same code get an error 503 "service unavailable".

On this last server, I wrote a java standalone app, re-using the exact same code as my webapp, to pick the info. I got no problems getting the info from the standalone app.

Here are errors i get when my code receive a 503 error :

			
MOTORCRAFT | 12/12/08 18:40:07 [recuperationDerniereInformationReseau() @ Information.java] http://demo5.etai.fr:8080/SERVICE
INFORMATIONS/Accueil
MOTORCRAFT | 12/12/08 18:40:07 [recuperationDerniereInformationReseau() @ Information.java] id_grp=5&demo=false&produit=MTC&t
ypeProduit=io&langue=fr
MOTORCRAFT | 12/12/08 18:40:07 [recuperationDerniereInformationReseau() @ Information.java] Erreur de connexion distante en h
ttp sur le serveur d'information - info
MOTORCRAFT | 12/12/08 18:40:07 [recuperationDerniereInformationReseau() @ Information.java] Exception : Unable to read input
stream StackTrace :
java.lang.Exception: Unable to read input stream
at fr.util.HttpClient.readResponse(HttpClient.java:65)
at fr.metier.informations.Information.recuperationDerniereInformationReseau(Information.java:147)
at fr.servlet.AffichageInformation.affichage(AffichageInformation.java:41)
at fr.servlet.AffichageInformation.affichePageInfoAccueil(AffichageInformation.java:103)
at fr.servlet.Identification.login(Identification.java:406)
at fr.servlet.Identification.doGet(Identification.java:104)
at fr.servlet.Identification.doPost(Identification.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.io.IOException: Server returned HTTP response code: 503 for URL: http://demo5.etai.fr:8080/SERVICEINFORMATIONS/Acc
ueil
at sun.net.http://www.protocol.http.HttpURLConn...tion.java:1153)
at fr.util.HttpClient.readResponse(HttpClient.java:53)
... 23 more
MOTORCRAFT | 12/12/08 18:40:07 [recuperationDerniereInformationReseau() @ Information.java] Exception : Server returned HTTP
response code: 503 for URL: http://demo5.etai.fr:8080/SERVICEINFORMATIONS/Accueil StackTrace :
java.io.IOException: Server returned HTTP response code: 503 for URL: http://demo5.etai.fr:8080/SERVICEINFORMATIONS/Accueil
at sun.net.http://www.protocol.http.HttpURLConn...tion.java:1153)
at fr.util.HttpClient.readResponse(HttpClient.java:53)
at fr.metier.informations.Information.recuperationDerniereInformationReseau(Information.java:147)
at fr.servlet.AffichageInformation.affichage(AffichageInformation.java:41)
at fr.servlet.AffichageInformation.affichePageInfoAccueil(AffichageInformation.java:103)
at fr.servlet.Identification.login(Identification.java:406)
at fr.servlet.Identification.doGet(Identification.java:104)
at fr.servlet.Identification.doPost(Identification.java:52)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)



I know this problem may happen because of version issues and thus, there's a lot of chance that nobody will be able to answer me exactly, but some hints might be appreciable :)


here is the code i use to connect to the information webapp :

			
HttpClient connexionServeurInfo = new HttpClient(urlServeurInfo);
connexionServeurInfo.connect("POST");
String toPost = "id_grp=" +id_grp + "&demo=" + isDemo + "&produit=" + abreviation+ "&typeProduit="+TYPE_PRODUIT +"&langue=" + pUtilisateur.getLangue();
Commun.trace(toPost);
connexionServeurInfo.post(toPost);
reponse = connexionServeurInfo.readResponse();
Commun.trace("message du serveur : " + reponse);
connexionServeurInfo.disconnect();



			
public class HttpClient {
protected URL url;
protected HttpURLConnection server;
// timeout entier en millisecond
protected int DEFAULT_TIMEOUT = 500;
/**
* @param szUrl: String object for the URL
*/
public HttpClient(String szUrl) throws Exception {
try {
url = new URL(szUrl);
} catch (Exception e) {
throw new Exception("Invalid URL", e);
}
}

/**
* @param method: String object for client method (POST, GET,...)
*/
public void connect(String method) throws Exception {
try {
server = (HttpURLConnection) url.openConnection();
server.setDoInput(true);
server.setDoOutput(true);
server.setRequestMethod(method);
server.setRequestProperty("Content-type",
"application/x-www-form-urlencoded");
server.setConnectTimeout(DEFAULT_TIMEOUT);
server.connect();
} catch (Exception e) {
throw new Exception("Connection failed",e);
}
}

public void disconnect() {
server.disconnect();
}

public String readResponse() throws Exception {
String line;
String toSend ="";
try {
BufferedReader s = new BufferedReader(new InputStreamReader(server
.getInputStream()));
line = s.readLine();
if(line!=null)
toSend += line;
while (line != null) {
Commun.trace(line);
line = s.readLine();
if(line!=null)
toSend += line;
}
s.close();
} catch (Exception e) {
throw new Exception("Unable to read input stream",e);
}
return toSend;
}

public void post(String s) throws Exception {
try {
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
server.getOutputStream()));
bw.write(s, 0, s.length());
bw.flush();
bw.close();
} catch (Exception e) {
throw new Exception("Unable to write to output stream",e);
}
}

}


thanks a lot for those who read this to the end ;)    <<Less
About | Sitemap | Contact