SpringVaadinServlet 从 VaadinServlet 调用缺少的方法?
SpringVaadinServlet calling a missing method from VaadinServlet?
我正在尝试按照 Vaadin Spring 教程进行操作,但在设置 servlet 时遇到错误。
这是我的 UI class 基于教程:
@SpringUI
@Theme("valo")
public class MyUI extends UI {
@Override
protected void init(VaadinRequest request) {
}
@WebServlet(urlPatterns = { "/MyUI/*", "/VAADIN/*" }, name = "MyUIServlet", asyncSupported = true)
public static class OperationRoomUIServlet extends SpringVaadinServlet {
}
错误信息如下:
java.lang.NoSuchMethodError: com.vaadin.server.VaadinServletService.addSessionInitListener(Lcom/vaadin/server/SessionInitListener;)Lcom/vaadin/shared/Registration;
at com.vaadin.spring.server.SpringVaadinServlet.servletInitialized(SpringVaadinServlet.java:75)
at com.vaadin.server.VaadinServlet.init(VaadinServlet.java:234)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1227)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1140)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
如果我只是将它设置为常规 vaadin servlet,它就可以工作,但我正在尝试将它与 Spring 集成,这样我就可以将它用作我的
@WebServlet(urlPatterns = { "/MyUI/*", "/VAADIN/*" }, name = "MyUISevlet", asyncSupported = true)
public static class MyUISevlet extends VaadinServlet {
}
您可能正在使用 Vaadin Spring 2,它适用于 Vaadin Framework 8,但以某种方式在项目中包含了 Vaadin Framework 7 jar。
在Vaadin Framework 8中,该方法存在
https://github.com/vaadin/framework/blob/8.0/server/src/main/java/com/vaadin/server/VaadinService.java#L447
但在 Vaadin Framework 7 中,它具有不同的签名
https://github.com/vaadin/framework/blob/7.7/server/src/main/java/com/vaadin/server/VaadinService.java#L415
我正在尝试按照 Vaadin Spring 教程进行操作,但在设置 servlet 时遇到错误。
这是我的 UI class 基于教程:
@SpringUI
@Theme("valo")
public class MyUI extends UI {
@Override
protected void init(VaadinRequest request) {
}
@WebServlet(urlPatterns = { "/MyUI/*", "/VAADIN/*" }, name = "MyUIServlet", asyncSupported = true)
public static class OperationRoomUIServlet extends SpringVaadinServlet {
}
错误信息如下:
java.lang.NoSuchMethodError: com.vaadin.server.VaadinServletService.addSessionInitListener(Lcom/vaadin/server/SessionInitListener;)Lcom/vaadin/shared/Registration;
at com.vaadin.spring.server.SpringVaadinServlet.servletInitialized(SpringVaadinServlet.java:75)
at com.vaadin.server.VaadinServlet.init(VaadinServlet.java:234)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1227)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1140)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
如果我只是将它设置为常规 vaadin servlet,它就可以工作,但我正在尝试将它与 Spring 集成,这样我就可以将它用作我的
@WebServlet(urlPatterns = { "/MyUI/*", "/VAADIN/*" }, name = "MyUISevlet", asyncSupported = true)
public static class MyUISevlet extends VaadinServlet {
}
您可能正在使用 Vaadin Spring 2,它适用于 Vaadin Framework 8,但以某种方式在项目中包含了 Vaadin Framework 7 jar。
在Vaadin Framework 8中,该方法存在 https://github.com/vaadin/framework/blob/8.0/server/src/main/java/com/vaadin/server/VaadinService.java#L447
但在 Vaadin Framework 7 中,它具有不同的签名 https://github.com/vaadin/framework/blob/7.7/server/src/main/java/com/vaadin/server/VaadinService.java#L415