2017-02-21 102 views
0

我想在gwt 2.6.1項目中添加一些websocket功能。 我遵循所有說明。可惜的是,我得到一個錯誤:添加氣氛後無法運行項目:(AtmosphereFrameworkInitializer.java:52)

[WARN] FAILED AtmosphereServlet: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 

堆棧跟蹤:

Starting Jetty on port 8888 
    [WARN] FAILED AtmosphereServlet: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
    at org.atmosphere.cpr.AtmosphereFrameworkInitializer.configureFramework(AtmosphereFrameworkInitializer.java:52) 
    at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:84) 
    at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:80) 
    at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75) 
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:534) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:346) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:786) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) 
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:541) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:162) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.Server.doStart(Server.java:282) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:740) 
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:522) 
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1104) 
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844) 
    at com.google.gwt.dev.DevMode.main(DevMode.java:322) 
    [WARN] FAILED c.g.g.d.s.j.WebAppContextWithReload{/,file:/C:/Mars/workspace/FenixWAR/src/main/webapp/},C:\Mars\workspace\FenixWAR\src\main\webapp: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
    at org.atmosphere.cpr.AtmosphereFrameworkInitializer.configureFramework(AtmosphereFrameworkInitializer.java:52) 
    at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:84) 
    at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:80) 
    at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75) 
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:534) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:346) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:786) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) 
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:541) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:162) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.Server.doStart(Server.java:282) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:740) 
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:522) 
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1104) 
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844) 
    at com.google.gwt.dev.DevMode.main(DevMode.java:322) 
    [WARN] FAILED [email protected]: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
    at org.atmosphere.cpr.AtmosphereFrameworkInitializer.configureFramework(AtmosphereFrameworkInitializer.java:52) 
    at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:84) 
    at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:80) 
    at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75) 
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:534) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:346) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:786) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) 
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:541) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:162) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.Server.doStart(Server.java:282) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:740) 
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:522) 
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1104) 
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844) 
    at com.google.gwt.dev.DevMode.main(DevMode.java:322) 
    [WARN] FAILED [email protected]: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
java.lang.NoSuchMethodError: javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;)Ljavax/servlet/ServletRegistration; 
    at org.atmosphere.cpr.AtmosphereFrameworkInitializer.configureFramework(AtmosphereFrameworkInitializer.java:52) 
    at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:84) 
    at org.atmosphere.cpr.AtmosphereServlet.configureFramework(AtmosphereServlet.java:80) 
    at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:75) 
    at org.eclipse.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:534) 
    at org.eclipse.jetty.servlet.ServletHolder.doStart(ServletHolder.java:346) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:786) 
    at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:265) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1242) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:717) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:494) 
    at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:541) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.handler.RequestLogHandler.doStart(RequestLogHandler.java:162) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.Server.doStart(Server.java:282) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:740) 
    at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:522) 
    at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1104) 
    at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:844) 
    at com.google.gwt.dev.DevMode.main(DevMode.java:322) 

它被部署使用GWT eclipse插件Jetty服務器上。

回答

1

它看起來像你試圖在碼頭7

javax.servlet.ServletContext.getServletRegistration(Ljava/lang/String;) 

經營的氛圍中的Servlet API 3.0版本中加入。 Jetty 7實現了servlet api的版本2.5,因此沒有實現getServeletRegistration方法。這應該解釋這個例外。

您可以嘗試將GWT Eclipse插件更新到3.0版。 (您可以在Eclipse市場找到它,並確保在安裝新插件之前卸載舊插件。)

或者您可以嘗試使用外部服務器(如Tomcat 7或8)。兩者都支持Servlet 3.0 API。

希望有所幫助。

+0

我有我的項目和您的示例項目從相同的Eclipse /插件/碼頭運行。我的項目不起作用,你的工作。這怎麼可能?我如何檢查碼頭的版本? – masterdany88

+1

將logLevel設置爲TRACE。在這種情況下,jetty的版本將顯示在日誌中。 –