嵌入式码头 - 503

Embedded jetty - 503

我从 https://www.eclipse.org/jetty/documentation/current/embedded-examples.html#embedded-one-webapp

开始

然后尝试了这个 Add web application context to Jetty 但我仍然得到 503。

我创建了一个简单的 index.html 用于测试...

<html>
<head>
</head>
<body>
Nothing to see here!
</body>
</html>

我的代码是...

public class WebTest {

    public static void main(String args[]) {

        Server server = new Server(8080);

        WebAppContext webapp = new WebAppContext();
        webapp.setContextPath("/test");
        webapp.setResourceBase("D:\testProject\src\main\webapp");
        webapp.setDescriptor("D:\testProject\src\main\webapp\WEB-INF\web.xml");
        webapp.setParentLoaderPriority(true);

        server.setHandler(webapp);
        try {
            server.start();
            server.join();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
}

并从控制台摘录...

40:35:297 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpChannel - REQUEST for //localhost:8080/test/index.html on HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=IDLE,uri=//localhost:8080/test/index.html}
GET //localhost:8080/test/index.html HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,en-GB;q=0.8


40:35:297 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=IDLE,uri=//localhost:8080/test/index.html} onContentComplete
40:35:297 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=IDLE,uri=//localhost:8080/test/index.html} onRequestComplete
40:35:297 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpInput - HttpInputOverHTTP@4d788b93[c=0,q=0,[0]=null,s=STREAM] addContent EOF
40:35:298 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpConnection - HttpConnection@5097ef2d[p=HttpParser{s=END,0 of -1},g=HttpGenerator@48d00098{s=START}]=>HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=IDLE,uri=//localhost:8080/test/index.html}<-SocketChannelEndPoint@4653f8a3{/0:0:0:0:0:0:0:1:50173<->/0:0:0:0:0:0:0:1:8080,OPEN,fill=-,flush=-,to=2/30000}{io=0/0,kio=0,kro=1}->HttpConnection@5097ef2d[p=HttpParser{s=END,0 of -1},g=HttpGenerator@48d00098{s=START}]=>HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=IDLE,uri=//localhost:8080/test/index.html} parsed true HttpParser{s=END,0 of -1}
40:35:298 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpConnection - releaseRequestBuffer HttpConnection@5097ef2d[p=HttpParser{s=END,0 of -1},g=HttpGenerator@48d00098{s=START}]=>HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=IDLE,uri=//localhost:8080/test/index.html}<-SocketChannelEndPoint@4653f8a3{/0:0:0:0:0:0:0:1:50173<->/0:0:0:0:0:0:0:1:8080,OPEN,fill=-,flush=-,to=3/30000}{io=0/0,kio=0,kro=1}->HttpConnection@5097ef2d[p=HttpParser{s=END,0 of -1},g=HttpGenerator@48d00098{s=START}]=>HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=IDLE,uri=//localhost:8080/test/index.html}
40:35:298 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=IDLE,uri=//localhost:8080/test/index.html} handle //localhost:8080/test/index.html 
40:35:298 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpChannelState - handling HttpChannelState@5b7dd1e2{s=IDLE a=NOT_ASYNC i=true r=IDLE w=false}
40:35:298 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpChannel - HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=DISPATCHED,uri=//localhost:8080/test/index.html} action DISPATCH
40:35:298 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.Server - REQUEST GET /test/index.html on HttpChannelOverHttp@6a9d23d4{r=3,c=false,a=DISPATCHED,uri=//localhost:8080/test/index.html}
40:35:298 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.handler.ContextHandler - scope null||/test/index.html @ o.e.j.w.WebAppContext@3419866c{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE}
40:35:299 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpChannel - sendResponse info=null content=DirectByteBuffer@daadc88[p=0,l=351,c=32768,r=351]={<<<<html>\n<head>\n<me.../body>\n</html>\n>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00} complete=true committing=true callback=Blocker@1099ae30{null}
40:35:299 [qtp1880587981-23] DEBUG org.eclipse.jetty.server.HttpChannel - COMMIT for /test/index.html on HttpChannelOverHttp@6a9d23d4{r=3,c=true,a=DISPATCHED,uri=//localhost:8080/test/index.html}
503 Service Unavailable HTTP/1.1
Date: Wed, 08 May 2019 07:40:35 GMT
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=iso-8859-1

编辑:

根据要求

20:12:500 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @20993ms ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
org.eclipse.jetty.server.Server@cd2dae5[9.4.8.v20171121] - STARTING
 += QueuedThreadPool@qtp488044861{STARTED,8<=8<=200,i=1,q=0} - STARTED
 |   +- 19 qtp488044861-19 SELECTING RUNNABLE @ sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 |   +- 18 qtp488044861-18 SELECTING RUNNABLE @ sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 |   +- 14 qtp488044861-14 SELECTING RUNNABLE @ sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 |   +- 16 qtp488044861-16 SELECTING RUNNABLE @ sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 |   +- 15 qtp488044861-15 SELECTING RUNNABLE @ sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 |   +- 17 qtp488044861-17 SELECTING RUNNABLE @ sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method)
 |   +- 21 qtp488044861-21 IDLE TIMED_WAITING @ sun.misc.Unsafe.park(Native Method)
 |   +- 20 qtp488044861-20-acceptor-0@22e357dc-ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} ACCEPTING RUNNABLE @ sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method) prio=3
 |   +- jobs
 += ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   +~ org.eclipse.jetty.server.Server@cd2dae5[9.4.8.v20171121] - STARTING
 |   +~ QueuedThreadPool@qtp488044861{STARTED,8<=8<=200,i=1,q=0} - STARTED
 |   += org.eclipse.jetty.util.thread.ScheduledExecutorScheduler@3dfc5fb8 - STARTED
 |   +- org.eclipse.jetty.io.ArrayByteBufferPool@c46bcd4
 |   += HttpConnectionFactory@4b553d26[HTTP/1.1] - STARTED
 |   |   +- HttpConfiguration@69a3d1d{32768/8192,8192/8192,https://:0,[]}
 |   += SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   |   += ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   |   += org.eclipse.jetty.io.ManagedSelector@140c9f39 id=0 keys=0 selected=0 actions=0 - STARTED
 |   |   |   += EatWhatYouKill@13b13b5d/SelectorProducer@1f97cf0d/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   |   |       +- SelectorProducer@1f97cf0d
20:12:539 [main] DEBUG org.eclipse.jetty.io.ManagedSelector - Queued change org.eclipse.jetty.io.ManagedSelector$DumpKeys@57af006c on org.eclipse.jetty.io.ManagedSelector@140c9f39 id=0 keys=0 selected=0 actions=0
20:12:539 [qtp488044861-14] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@111280a6 woken up from select, 0/0 selected
20:12:540 [qtp488044861-14] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@111280a6 processing 0 keys, 1 actions
20:12:540 [qtp488044861-14] DEBUG org.eclipse.jetty.io.ManagedSelector - action=org.eclipse.jetty.io.ManagedSelector$DumpKeys@57af006c wakeup=false
20:12:541 [qtp488044861-14] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@13b13b5d/SelectorProducer@1f97cf0d/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@57af006c/NON_BLOCKING
20:12:541 [qtp488044861-14] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@13b13b5d/SelectorProducer@1f97cf0d/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} PC t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@57af006c
20:12:541 [qtp488044861-14] DEBUG org.eclipse.jetty.io.ManagedSelector - Forcing selection, actions=0
20:12:541 [qtp488044861-14] DEBUG org.eclipse.jetty.io.ManagedSelector - action=null wakeup=false
 |   |   |  20:12:541 [qtp488044861-14] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@111280a6 waiting on select
 +- keys
 |   |   |   |   +- sun.nio.ch.WindowsSelectorImpl@111280a6 keys=0
 |   |   |   +- actions
 |   |   += org.eclipse.jetty.io.ManagedSelector@7690781 id=1 keys=0 selected=0 actions=0 - STARTED
 |   |   |   += EatWhatYouKill@4d910fd6/SelectorProducer@26275bef/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   |   |       +- SelectorProducer@26275bef
20:12:546 [main] DEBUG org.eclipse.jetty.io.ManagedSelector - Queued change org.eclipse.jetty.io.ManagedSelector$DumpKeys@6bedbc4d on org.eclipse.jetty.io.ManagedSelector@7690781 id=1 keys=0 selected=0 actions=0
20:12:547 [qtp488044861-15] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@3965fa68 woken up from select, 0/0 selected
20:12:547 [qtp488044861-15] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@3965fa68 processing 0 keys, 1 actions
20:12:547 [qtp488044861-15] DEBUG org.eclipse.jetty.io.ManagedSelector - action=org.eclipse.jetty.io.ManagedSelector$DumpKeys@6bedbc4d wakeup=false
20:12:548 [qtp488044861-15] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@4d910fd6/SelectorProducer@26275bef/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@6bedbc4d/NON_BLOCKING
20:12:548 [qtp488044861-15] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@4d910fd6/SelectorProducer@26275bef/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} PC t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@6bedbc4d
20:12:548 [qtp488044861-15] DEBUG org.eclipse.jetty.io.ManagedSelector - Forcing selection, actions=0
 |   |   |   +- 20:12:548 [qtp488044861-15] DEBUG org.eclipse.jetty.io.ManagedSelector - action=null wakeup=false
keys20:12:548 [qtp488044861-15] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@3965fa68 waiting on select

 |   |   |   |   +- sun.nio.ch.WindowsSelectorImpl@3965fa68 keys=0
 |   |   |   +- actions
 |   |   += org.eclipse.jetty.io.ManagedSelector@2e222612 id=2 keys=0 selected=0 actions=0 - STARTED
 |   |   |   += EatWhatYouKill@77eca502/SelectorProducer@3246fb96/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   |   |       +- SelectorProducer@3246fb96
20:12:551 [main] DEBUG org.eclipse.jetty.io.ManagedSelector - Queued change org.eclipse.jetty.io.ManagedSelector$DumpKeys@932bc4a on org.eclipse.jetty.io.ManagedSelector@2e222612 id=2 keys=0 selected=0 actions=0
20:12:551 [qtp488044861-16] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@7fb8c369 woken up from select, 0/0 selected
20:12:551 [qtp488044861-16] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@7fb8c369 processing 0 keys, 1 actions
20:12:552 [qtp488044861-16] DEBUG org.eclipse.jetty.io.ManagedSelector - action=org.eclipse.jetty.io.ManagedSelector$DumpKeys@932bc4a wakeup=false
20:12:552 [qtp488044861-16] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@77eca502/SelectorProducer@3246fb96/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@932bc4a/NON_BLOCKING
20:12:552 [qtp488044861-16] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@77eca502/SelectorProducer@3246fb96/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} PC t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@932bc4a
20:12:552 [qtp488044861-16] DEBUG org.eclipse.jetty.io.ManagedSelector - Forcing selection, actions=0
20:12:552 [qtp488044861-16] DEBUG org.eclipse.jetty.io.ManagedSelector - action=null wakeup=false
 |   |   |   +- keys
20:12:552 [qtp488044861-16] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@7fb8c369 waiting on select
 |   |   |   |   +- sun.nio.ch.WindowsSelectorImpl@7fb8c369 keys=0
 |   |   |   +- actions
 |   |   += org.eclipse.jetty.io.ManagedSelector@7671cb68 id=3 keys=0 selected=0 actions=0 - STARTED
 |   |   |   += EatWhatYouKill@61386958/SelectorProducer@73ee04c8/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   |   |       +- SelectorProducer@73ee04c8
20:12:557 [main] DEBUG org.eclipse.jetty.io.ManagedSelector - Queued change org.eclipse.jetty.io.ManagedSelector$DumpKeys@d29f28 on org.eclipse.jetty.io.ManagedSelector@7671cb68 id=3 keys=0 selected=0 actions=0
20:12:558 [qtp488044861-17] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@2b9c7198 woken up from select, 0/0 selected
20:12:558 [qtp488044861-17] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@2b9c7198 processing 0 keys, 1 actions
20:12:558 [qtp488044861-17] DEBUG org.eclipse.jetty.io.ManagedSelector - action=org.eclipse.jetty.io.ManagedSelector$DumpKeys@d29f28 wakeup=false
20:12:559 [qtp488044861-17] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@61386958/SelectorProducer@73ee04c8/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@d29f28/NON_BLOCKING
20:12:559 [qtp488044861-17] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@61386958/SelectorProducer@73ee04c8/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} PC t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@d29f28
20:12:559 [qtp488044861-17] DEBUG org.eclipse.jetty.io.ManagedSelector - Forcing selection, actions=0
20:12:559 [qtp488044861-17] DEBUG org.eclipse.jetty.io.ManagedSelector - action=null wakeup=false
20:12:559 [qtp488044861-17] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@2b9c7198 waiting on select
 |   |   |   +- keys
 |   |   |   |   +- sun.nio.ch.WindowsSelectorImpl@2b9c7198 keys=0
 |   |   |   +- actions
 |   |   += org.eclipse.jetty.io.ManagedSelector@68c72235 id=4 keys=0 selected=0 actions=0 - STARTED
 |   |   |   += EatWhatYouKill@49dc7102/SelectorProducer@6b8ca3c8/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   |   |       +- SelectorProducer@6b8ca3c8
20:12:565 [main] DEBUG org.eclipse.jetty.io.ManagedSelector - Queued change org.eclipse.jetty.io.ManagedSelector$DumpKeys@2fd1433e on org.eclipse.jetty.io.ManagedSelector@68c72235 id=4 keys=0 selected=0 actions=0
20:12:566 [qtp488044861-18] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@34aae006 woken up from select, 0/0 selected
20:12:567 [qtp488044861-18] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@34aae006 processing 0 keys, 1 actions
20:12:567 [qtp488044861-18] DEBUG org.eclipse.jetty.io.ManagedSelector - action=org.eclipse.jetty.io.ManagedSelector$DumpKeys@2fd1433e wakeup=false
20:12:567 [qtp488044861-18] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@49dc7102/SelectorProducer@6b8ca3c8/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@2fd1433e/NON_BLOCKING
20:12:567 [qtp488044861-18] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@49dc7102/SelectorProducer@6b8ca3c8/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} PC t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@2fd1433e
20:12:568 [qtp488044861-18] DEBUG org.eclipse.jetty.io.ManagedSelector - Forcing selection, actions=0
 |   |   |  20:12:568 [qtp488044861-18] DEBUG org.eclipse.jetty.io.ManagedSelector - action=null wakeup=false
 +- 20:12:568 [qtp488044861-18] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@34aae006 waiting on select
keys
 |   |   |   |   +- sun.nio.ch.WindowsSelectorImpl@34aae006 keys=0
 |   |   |   +- actions
 |   |   += org.eclipse.jetty.io.ManagedSelector@34f7cfd9 id=5 keys=0 selected=0 actions=0 - STARTED
 |   |       += EatWhatYouKill@10959ece/SelectorProducer@3a6bb9bf/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} - STARTED
 |   |           +- SelectorProducer@3a6bb9bf
20:12:572 [main] DEBUG org.eclipse.jetty.io.ManagedSelector - Queued change org.eclipse.jetty.io.ManagedSelector$DumpKeys@29d89d5d on org.eclipse.jetty.io.ManagedSelector@34f7cfd9 id=5 keys=0 selected=0 actions=0
20:12:572 [qtp488044861-19] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@63f3b36b woken up from select, 0/0 selected
20:12:572 [qtp488044861-19] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@63f3b36b processing 0 keys, 1 actions
20:12:572 [qtp488044861-19] DEBUG org.eclipse.jetty.io.ManagedSelector - action=org.eclipse.jetty.io.ManagedSelector$DumpKeys@29d89d5d wakeup=false
20:12:573 [qtp488044861-19] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@10959ece/SelectorProducer@3a6bb9bf/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@29d89d5d/NON_BLOCKING
20:12:573 [qtp488044861-19] DEBUG org.eclipse.jetty.util.thread.strategy.EatWhatYouKill - EatWhatYouKill@10959ece/SelectorProducer@3a6bb9bf/PRODUCING/ReservedThreadExecutor@524d6d96{s=0/12,p=0}@SelectorManager@ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} PC t=org.eclipse.jetty.io.ManagedSelector$DumpKeys@29d89d5d
20:12:573 [qtp488044861-19] DEBUG org.eclipse.jetty.io.ManagedSelector - Forcing selection, actions=0
 |   |      20:12:573 [qtp488044861-19] DEBUG org.eclipse.jetty.io.ManagedSelector - action=null wakeup=false
 +- 20:12:573 [qtp488044861-19] DEBUG org.eclipse.jetty.io.ManagedSelector - Selector sun.nio.ch.WindowsSelectorImpl@63f3b36b waiting on select
keys
 |   |       |   +- sun.nio.ch.WindowsSelectorImpl@63f3b36b keys=0
 |   |       +- actions
 |   +- sun.nio.ch.ServerSocketChannelImpl[/0:0:0:0:0:0:0:0:8080]
 |   +- qtp488044861-20-acceptor-0@22e357dc-ServerConnector@2353b3e6{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
 += o.e.j.w.WebAppContext@1372ed45{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE} - STARTED
 |   += org.eclipse.jetty.server.session.SessionHandler1786364562==dftMaxIdleSec=1800 - STARTED
 |   |   += org.eclipse.jetty.security.ConstraintSecurityHandler@27c6e487 - STARTED
 |   |   |   +- org.eclipse.jetty.security.DefaultAuthenticatorFactory@49070868
 |   |   |   += org.eclipse.jetty.servlet.ServletHandler@7364985f - STARTED
 |   |   |   |   += org.eclipse.jetty.servlet.ListenerHolder@223d2c72 - STARTED
 |   |   |   |   += org.eclipse.jetty.servlet.ListenerHolder@4ec4f3a0 - STARTED
 |   |   |   |   += default@5c13d641==org.eclipse.jetty.servlet.DefaultServlet,jsp=null,order=0,inst=true - STARTED
 |   |   |   |   |   +- aliases=false
 |   |   |   |   |   +- dirAllowed=true
 |   |   |   |   |   +- maxCacheSize=256000000
 |   |   |   |   |   +- maxCachedFileSize=200000000
 |   |   |   |   |   +- welcomeServlets=false
 |   |   |   |   |   +- useFileMappedBuffer=true
 |   |   |   |   |   +- acceptRanges=true
 |   |   |   |   |   +- etags=false
 |   |   |   |   |   +- maxCachedFiles=2048
 |   |   |   |   |   +- redirectWelcome=false
 |   |   |   |   += jsp@19c47==org.eclipse.jetty.servlet.NoJspServlet,jsp=null,order=0,inst=true - STARTED
 |   |   |   |   |   +- fork=false
 |   |   |   |   |   +- compilerSourceVM=1.7
 |   |   |   |   |   +- logVerbosityLevel=DEBUG
 |   |   |   |   |   +- compilerTargetVM=1.7
 |   |   |   |   |   +- xpoweredBy=false
 |   |   |   |   +- [/]=>default
 |   |   |   |   +- [*.jsp, *.jspf, *.jspx, *.xsp, *.JSP, *.JSPF, *.JSPX, *.XSP]=>jsp
 |   |   |   |   += faces-servlet@3b85952e==javax.faces.webapp.FacesServlet,jsp=null,order=1,inst=false - STARTED
 |   |   |   |   +- [*.xhtml]=>faces-servlet
 |   |   |   +> null
 |   |   |   +> null
 |   |   |   +> null
 |   |   |   +> []
 |   |   |   +> /={TRACE={RoleInfo,F,C[],None}, TRACE.omission={RoleInfo[],None}}
 |   |   += org.eclipse.jetty.server.session.DefaultSessionCache@4d5d943d[evict=-1,removeUnloadable=false,saveOnCreate=false,saveOnInactiveEvict=false] - STARTED
 |   |   |   += org.eclipse.jetty.server.session.NullSessionDataStore@3270d194[passivating=false,graceSec=3600] - STARTED
 |   |   +~ org.eclipse.jetty.server.session.DefaultSessionIdManager@14cd1699[worker=node0] - STARTED
 |   += org.eclipse.jetty.servlet.ErrorPageErrorHandler@5d20e46 - STARTED
 |   +> WebAppClassLoader=282821294@10db82ae
 |   |   +- sun.misc.Launcher$AppClassLoader@18b4aac2
 |   +> Systemclasses o.e.j.w.WebAppContext@1372ed45{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE}
 |   |   +- java.
 |   |   +- javax.
 |   |   +- org.eclipse.jetty.continuation.
 |   |   +- org.eclipse.jetty.jaas.
 |   |   +- org.eclipse.jetty.jmx.
 |   |   +- org.eclipse.jetty.jndi.
 |   |   +- org.eclipse.jetty.jsp.JettyJspServlet
 |   |   +- org.eclipse.jetty.servlet.DefaultServlet
 |   |   +- org.eclipse.jetty.servlets.PushCacheFilter
 |   |   +- org.eclipse.jetty.servlets.PushSessionCacheFilter
 |   |   +- org.eclipse.jetty.util.annotation.
 |   |   +- org.eclipse.jetty.util.log.
 |   |   +- org.eclipse.jetty.websocket.
 |   |   +- org.w3c.
 |   |   +- org.xml.
 |   +> Serverclasses o.e.j.w.WebAppContext@1372ed45{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE}
 |   |   +- -org.eclipse.jetty.alpn.
 |   |   +- -org.eclipse.jetty.apache.
 |   |   +- -org.eclipse.jetty.continuation.
 |   |   +- -org.eclipse.jetty.jaas.
 |   |   +- -org.eclipse.jetty.jmx.
 |   |   +- -org.eclipse.jetty.jndi.
 |   |   +- -org.eclipse.jetty.jsp.
 |   |   +- -org.eclipse.jetty.server.session.SessionData
 |   |   +- -org.eclipse.jetty.servlet.DefaultServlet
 |   |   +- -org.eclipse.jetty.servlet.NoJspServlet
 |   |   +- -org.eclipse.jetty.servlet.listener.
 |   |   +- -org.eclipse.jetty.servlets.
 |   |   +- -org.eclipse.jetty.util.annotation.
 |   |   +- -org.eclipse.jetty.util.log.
 |   |   +- -org.eclipse.jetty.websocket.
 |   |   +- org.eclipse.jdt.
 |   |   +- org.eclipse.jetty.
 |   |   +- org.objectweb.asm.
 |   +> Configurations o.e.j.w.WebAppContext@1372ed45{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE}
 |   |   +- org.eclipse.jetty.webapp.WebInfConfiguration@78b729e6
 |   |   +- org.eclipse.jetty.webapp.WebXmlConfiguration@43301423
 |   |   +- org.eclipse.jetty.webapp.MetaInfConfiguration@1ab3a8c8
 |   |   +- org.eclipse.jetty.webapp.FragmentConfiguration@333291e3
 |   |   +- org.eclipse.jetty.webapp.JettyWebXmlConfiguration@479d31f3
 |   +> Handler attributes o.e.j.w.WebAppContext@1372ed45{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE}
 |   |   +- javax.servlet.context.tempdir=C:\Users\rober\AppData\Local\Temp\jetty-0.0.0.0-8080-webapp-_test-any-7857156332074108835.dir
 |   |   +- org.eclipse.jetty.tlds=[]
 |   |   +- org.eclipse.jetty.resources=[]
 |   |   +- org.eclipse.jetty.server.Executor=QueuedThreadPool@qtp488044861{STARTED,8<=8<=200,i=1,q=0}
 |   |   +- org.eclipse.jetty.webFragments={}
 |   +> Context attributes o.e.j.w.WebAppContext@1372ed45{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE}
 |   |   +- org.eclipse.jetty.util.DecoratedObjectFactory=org.eclipse.jetty.util.DecoratedObjectFactory[decorators=1]
 |   |   +- resourceCache=ResourceCache[null,org.eclipse.jetty.servlet.DefaultServlet@45c7e403]@890545344
 |   +> Initparams o.e.j.w.WebAppContext@1372ed45{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE}
 += org.eclipse.jetty.server.handler.ErrorHandler@45f45fa1 - STARTED
 +- {}
 +- {}
 +- {}
 += org.eclipse.jetty.server.session.DefaultSessionIdManager@14cd1699[worker=node0] - STARTED
 |   += org.eclipse.jetty.server.session.HouseKeeper@1bb5a082[interval=600000, ownscheduler=true] - STARTED
 +> sun.misc.Launcher$AppClassLoader@18b4aac2
     +- file:/D:/testProject/target/classes/
     +- file:/C:/Users/rober/.m2/repository/org/slf4j/slf4j-api/1.7.26/slf4j-api-1.7.26.jar
     +- file:/C:/Users/rober/.m2/repository/org/slf4j/slf4j-simple/1.7.26/slf4j-simple-1.7.26.jar
     +- file:/C:/Users/rober/.m2/repository/com/ghgande/j2mod/2.5.3/j2mod-2.5.3.jar
     +- file:/C:/Users/rober/.m2/repository/com/fazecast/jSerialComm/2.3.0/jSerialComm-2.3.0.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/kura/jdk.dio/1.0.100/jdk.dio-1.0.100.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/kura/org.eclipse.soda.dk.comm/1.2.100/org.eclipse.soda.dk.comm-1.2.100.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/tycho/org.eclipse.osgi/3.8.1.v20120830-144521/org.eclipse.osgi-3.8.1.v20120830-144521.jar
     +- file:/C:/Users/rober/.m2/repository/com/sun/faces/jsf-api/2.1.7/jsf-api-2.1.7.jar
     +- file:/C:/Users/rober/.m2/repository/com/sun/faces/jsf-impl/2.1.7/jsf-impl-2.1.7.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/jetty/jetty-server/9.4.8.v20171121/jetty-server-9.4.8.v20171121.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/jetty/jetty-http/9.4.8.v20171121/jetty-http-9.4.8.v20171121.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/jetty/jetty-util/9.4.8.v20171121/jetty-util-9.4.8.v20171121.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/jetty/jetty-io/9.4.8.v20171121/jetty-io-9.4.8.v20171121.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/jetty/jetty-webapp/9.4.8.v20171121/jetty-webapp-9.4.8.v20171121.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/jetty/jetty-xml/9.4.8.v20171121/jetty-xml-9.4.8.v20171121.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/jetty/jetty-servlet/9.4.8.v20171121/jetty-servlet-9.4.8.v20171121.jar
     +- file:/C:/Users/rober/.m2/repository/org/eclipse/jetty/jetty-security/9.4.8.v20171121/jetty-security-9.4.8.v20171121.jar
     +- file:/C:/Users/rober/.m2/repository/javax/el/javax.el-api/2.2.4/javax.el-api-2.2.4.jar
     +- file:/C:/Users/rober/.m2/repository/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar
     +- file:/D:/work/eclipses/GV_Services/eclipse/configuration/org.eclipse.osgi/221/0/.cp/lib/javaagent-shaded.jar
     +- sun.misc.Launcher$ExtClassLoader@501edcf1
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/access-bridge-64.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/cldrdata.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/dnsns.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/jaccess.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/jfxrt.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/localedata.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/nashorn.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/sunec.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/sunjce_provider.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/sunmscapi.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/sunpkcs11.jar
         +- file:/C:/Program%20Files/Java/jre1.8.0_211/lib/ext/zipfs.jar
20:12:594 [main] INFO org.eclipse.jetty.server.Server - Started @21092ms
20:12:595 [main] DEBUG org.eclipse.jetty.util.component.AbstractLifeCycle - STARTED @21093ms org.eclipse.jetty.server.Server@cd2dae5[9.4.8.v20171121]

转储显示...

o.e.j.w.WebAppContext@1372ed45{/test,file:///D:/testProject/src/main/webapp/,UNAVAILABLE} - STARTED

这表示您在 /test 的 webapp 已启动,但最终处于 "Unavailable" 状态。

这就是您收到 503 错误的原因,如果上下文被标记为不可用,Jetty 服务器将以 503 响应。 (甚至从未尝试与您的网络应用程序通信)

接下来我们需要注意您的 webapp 的启动日志记录,在部署 and/or webapp 的初始化阶段出现错误。

首先升级到更现代的 Jetty 9 版本。4.x,你的 9.4.8 很旧,而且还有几个已知漏洞。请使用9.4.18.v20190429.

我看到了一些 non-jetty jar,因此您可能需要设置多个日志记录框架才能与您的 slf4j-api 层一起使用。

至少添加 Java Util Logging to Slf4J bridge(以捕获 jsf 和 el 层)。然后处理 OSGi 日志记录,最后是 j2mod、jSerialComm 和 eclipse-kura 库使用与 slf4j 类似的桥接的任何日志记录。

事实证明,如果 jetty 用作嵌入式,则不会扫描 类。无法使用带注释的嵌入式码头。

解决方案是

  • 废弃注释并使用网络和 faces-config xml
  • 创建自己的 jetty 分支并将其更改为查找 WEB-INF/classes
  • 以外的文件夹
  • 使用jetty:run-war