I need to start the local server using jetty drivers with java 11. I can start the server and access it with Java8, but with java 11 when I use curl command to check if the server is accessible it returns following:
$ curl http://localhost:8080//sample/site/URL/info
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 503 Service Unavailable</title>
</head>
<body><h2>HTTP ERROR 503</h2>
<p>Problem accessing /sample/site/URL/info. Reason:
<pre> Service Unavailable</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.20.v20190813</a><hr/>
</body>
</html>
Stack Trace
java.io.IOException: Server returned HTTP response code: 503 for URL: http://localhost:8080/idp/idpservice/register
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894) ~[na:1.8.0_192]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[na:1.8.0_192]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_192]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_192]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_192]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_192]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar!/:na]
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808) [jetty-servlet-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587) [jetty-servlet-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577) [jetty-security-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515) [jetty-servlet-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.Server.handle(Server.java:497) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) [jetty-server-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540) [jetty-io-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) [jetty-util-9.2.9.v20150224.jar!/:na]
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) [jetty-util-9.2.9.v20150224.jar!/:na]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_192]
As you can see I am using the Jetty 9.4.20.v20190813
version jars.
Any idea what other things I should be looking into apart from jetty?
Jetty version
As you can see I am using the Jetty
9.4.20.v20190813
version jars. Any idea what other things I should be looking into apart from jetty?
Actually, your stacktrace says otherwise...
... .run(QueuedThreadPool.java:555) [jetty-util-9.2.9.v20150224.jar!/:na]
Jetty 9.2.x is EOL (End of Life).
See: https://www.eclipse.org/jetty/documentation/current/what-jetty-version.html
Support for Java 11 didn't land until Jetty 9.4.8
503 Cause according to your Stacktrace
The Status code 503 in your stacktrace comes from HttpURLConnection
, not Jetty.
java.io.IOException: Server returned HTTP response code: 503 for URL: http://localhost:8080/idp/idpservice/register
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894) ~[na:1.8.0_192]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) ~[na:1.8.0_192]
URL Mismatch
Your stacktrace and your original question are using different URLs.
Original question
http://localhost:8080//sample/site/URL/info
Stacktrace
http://localhost:8080/idp/idpservice/register
How Jetty responds with 503
There are only a handful of places where Jetty itself will respond with a status code 503 (Service Unavailable). (all other status code 503 responses are from the Application and it's own libraries, not Jetty)
org.eclipse.jetty.servlets.DataRateLimitedServlet
will respond to directory requests (those ending in /
) with a status code 503. (no servlets or filters in Jetty itself use this Servlet)javax.servlet.UnavailableException
during handling of a requestThat's all of the 503 origins in Jetty itself.
The most common cause of 503 is a bad webapp deployment, and only the logs from your server side (during the deployment of your webapp) will help discover this state and the reason for it.