gpt4 book ai didi

java - SpringVaadinServlet 调用 VaadinServlet 中缺少的方法?

转载 作者:行者123 更新时间:2023-12-02 12:43:46 24 4
gpt4 key购买 nike

我正在尝试遵循 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 {

}

最佳答案

您可能正在使用 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

关于java - SpringVaadinServlet 调用 VaadinServlet 中缺少的方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44854906/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com