我試圖將WebAppContext設置爲Jetty服務器處理程序,並且它在server.setHandler()調用時失敗。在例外情況下給出以下消息。任何幫助將不勝感激。 (Lorg/eclipse/jetty/server/HandlerContainer; Ljava/lang/String; Lorg/eclipse/jetty/server/session/SessionHandler; Lorg/eclipse/jetty/security)下載本文檔需要登錄,並付出相應積分。/SecurityHandler; Lorg /蝕/碼頭/ servlet的/ ServletHandler; Lorg /蝕/碼頭/服務器/處理/的ErrorHandler;我)V將WebContextHandler設置爲碼頭服務器失敗
WebAppContext webAppContext = new WebAppContext("samples/webapp", "/");
webAppContext.setConfigurationClasses(new String[]{
"org.eclipse.jetty.webapp.WebInfConfiguration",
"org.eclipse.jetty.webapp.WebXmlConfiguration"});
Server server = new Server(port);
server.setHandler(webAppContext);
server.start();
我使用碼頭版本9.2.16.v20160414。提前致謝。
求助: 現在就解決了。存在依賴衝突
嗨Rajind,我注意到,在server.setHandler(),您提供一個工廠WebAppContext對象,而不是使用您上面定義的一個。這可能與你得到的錯誤有關嗎? –
@LucasT。抱歉。在那裏添加代碼時我犯了一個錯誤。不,我實際上是在我原來的代碼中使用聲明的。 –
嗨Rajind,這個jetty實例是否與任何java web應用程序框架有關? –