gpt4 book ai didi

java - Vaadin 7 Servlet ClassCastException 问题

转载 作者:搜寻专家 更新时间:2023-11-01 03:08:14 25 4
gpt4 key购买 nike

我正在尝试从 Vaadin 6 迁移到 Vaadin 7。
当我试图打开应用程序 url 时,我得到一个 ClassCastException

SEVERE: Allocate exception for servlet Vaadin Application Servlet
java.lang.ClassCastException: com.vaadin.server.VaadinServlet cannot be cast to javax.servlet.Servlet
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1136)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:857)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:136)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

我不明白哪里出了问题,因为 web.xml 似乎没问题。下面列出了应用程序 servlet 的映射

 <servlet>
<servlet-name>Ohta Application</servlet-name>
<servlet-class>com.vaadin.server.VaadinServlet</servlet-class>
<init-param>
<description>
Vaadin UI class to use</description>
<param-name>UI</param-name>
<param-value>com.ritmsoft.ohta.OhtaUI</param-value>
</init-param>
<init-param>
<param-name>widgetset</param-name>
<param-value>com.ritmsoft.ohta.widgetset.OhtaWidgetSet</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Ohta Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Ohta Application</servlet-name>
<url-pattern>/VAADIN/*</url-pattern>
</servlet-mapping>

请帮帮我

最佳答案

或者,如果您使用 Maven,则像这样“提供”您的 servlet 的范围:

    <dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>

这样它将使用容器版本的 servlet jar(如果存在),否则它将使用您在 Maven 中声明的版本。

关于java - Vaadin 7 Servlet ClassCastException 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15208090/

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