簡體   English   中英

設置處理程序時 Jetty Server 阻塞

[英]Jetty Server blocks when setting handler

我正在嘗試使用 Servlet 上下文設置 Jetty 服務器,並且在調用server.setHandler(context)時它會阻塞。 如果我從下面運行代碼片段,它實際上遵循http://www.eclipse.org/jetty/documentation/9.3.x/embedding-jetty.html#_embedding_servletcontexts 中的示例,它只打印一個“a”和然后阻止。

ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");

Server server = new Server(8070);
log.info("a");
server.setHandler(context);

log.info("a");
context.addServlet(EventServer.class, "/response");
context.addServlet(NotificationServer.class, "/notification");

log.info("a");
context.addEventListener(new ConfigureService());
context.addEventListener(new NotificationService());

try {
        server.start();
        log.info("Jetty-Server Started");
        server.join();
} catch (Exception e) {
        log.error(ExceptionUtils.getFullStackTrace(e));
} finally {
        server.destroy();
}

知道為什么它在設置處理程序時不執行其余的代碼和塊嗎?

事實證明,當jetty-serverjetty-servlet版本不同時,您實際上無法運行它們,這會在設置處理程序時導致阻塞。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM