在wildfly中部署vaadin servlet(使用vaadin CDI)时出错

时间:2018-04-04 19:40:48

标签: vaadin wildfly cdi wildfly-11

我试图在wildfly 11(来自eclipse中)部署基于vaadin CDI的战争,但我有以下错误:

21:14:36,578 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host."/myapp-1.0-SNAPSHOT".UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host."/myapp-1.0-SNAPSHOT".UndertowDeploymentInfoService: java.lang.ClassNotFoundException: com.vaadin.cdi.internal.VaadinCDIServlet from [Module "deployment.myapp-1.0-SNAPSHOT.war" from Service Module Loader]
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:1096)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:273)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.vaadin.cdi.internal.VaadinCDIServlet from [Module "deployment.myapp-1.0-SNAPSHOT.war" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:725)
... 6 more

获得VaadinCDIServlet课程似乎有问题。 这些是我在pom.xml中的依赖项

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>8.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-server</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-push</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-client-compiled</artifactId>
    </dependency>
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-themes</artifactId>
    </dependency>
    <!-- The following 2 are necessary to vaadin CDI -->
    <dependency>
        <groupId>com.vaadin</groupId>
        <artifactId>vaadin-cdi</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <version>1.2</version>
    </dependency>
</dependencies>

我在WEB-INF下有一个空的beans.xml文件。 任何人都知道我错过了什么?

2 个答案:

答案 0 :(得分:2)

你的CDI api应该在&#34;提供&#34;范围,将其置于默认范围内可能会导致奇怪的问题。

我建议使用the Viritin CDI archetype启动您的项目,然后从一开始就获得所有内容。

答案 1 :(得分:1)

您是否记得从主UI类中删除VaadinServlet?