SpringVaadinServlet从VaadinServlet调用一个缺少的方法?

时间:2017-06-30 21:14:00

标签: java spring vaadin vaadin7

我试图按照Vaadin Spring教程进行操作,并且我在设置servlet时遇到错误。

这是我基于教程的UI类:

@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 {

}

1 个答案:

答案 0 :(得分:1)

你可能正在使用Vaadin Spring 2,它适用于Vaadin Framework 8,但在项目中以某种方式包含了Vaadin Framework 7罐子。

在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