我想在gwt 2.6.1项目中添加一些websocket功能。 我遵循了所有指示。不幸的是我收到了一个错误:
[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 org.eclipse.jetty.server.handler.RequestLogHandler@da24d41: 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 org.eclipse.jetty.server.Server@1a7ded65: 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服务器上。
答案 0 :(得分:1)
看起来你正试图在Jetty 7上营造气氛。
{
"error" : {
"SaveContactMethod":"FirstName Invalid",
"SaveContactMethod":"LastName Invalid",
"SaveContactMethod":"MiddleName Invalid"
}
}
在servlet api的第3版中添加。 Jetty 7实现了servlet api的2.5版本,因此没有实现getServeletRegistration方法。哪个应该解释异常。
您可以尝试将GWT Eclipse插件更新到3.0版。 (您可以在Eclipse市场找到它,并确保在安装新插件之前卸载旧插件。)
或者您可以尝试使用Tomcat 7或8等外部服务器。两者都支持Servlet 3.0 API。
希望有所帮助。