首页 文章

带有JavaEE 7,NetBeans 8,WildFly 9的Vaadin-CDI带来了WELD-001408:带有限定符的类型问候语@Default的不满意依赖关系

提问于
浏览
1

我正在尝试将Vaadin-CDI-Tutorial part II与环境一起使用:

  • NetBeans 8.0.2

  • WildFly 9

  • Java EE 7

  • JDK和JRE 1.8.0-60 64位

  • Windows 7 64位

在部署时,我得到:引起:org.jboss.weld.exceptions.DeploymentException:WELD-001408:类型Greeting的不满意依赖关系,带有限定符@Default at injection point [BackedAnnotatedField] @Inject private com.vaadin.cdi.tutorial.MyUI . cometing at com.vaadin.cdi.tutorial.MyUI.greeting(MyUI.java:0)

我的文件是:

Greeting.java
package com.vaadin.cdi.tutorial;

public interface Greeting {
    public String getText();
}

MyUI.java

package com.vaadin.cdi.tutorial;


import com.vaadin.annotations.Theme;
import com.vaadin.annotations.Widgetset;
import com.vaadin.cdi.CDIUI;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Label;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;
import javax.inject.Inject;

@Theme("valo")
@CDIUI("")
@Widgetset("com.vaadin.cdi.tutorial.MyAppWidgetset")
public class MyUI extends UI {

    @Inject
    private Greeting greeting;

    @Override
    protected void init(VaadinRequest vaadinRequest) {
        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        setContent(layout);

        Button button = new Button("Click Me");
        button.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                layout.addComponent(new Label(greeting.getText()));
            }
        });
        layout.addComponent(button);

    }

}

SimpleGreetingImpl.java

package com.vaadin.cdi.tutorial;

import java.io.Serializable;

public class SimpleGreetingImpl implements Greeting, Serializable {

    @Override
    public String getText() {
        return "Hello, World!";
    }

}

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>

        <groupId>com.vaadin</groupId>
        <artifactId>cdi-tutorial</artifactId>
        <packaging>war</packaging>
        <version>1.0</version>
        <name>cdi-tutorial</name>

        <properties>
                <vaadin.version>7.5.4</vaadin.version>
                <vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
                <jetty.plugin.version>9.2.3.v20140905</jetty.plugin.version>
                <project.source.version>1.7</project.source.version>
                <project.target.version>1.7</project.target.version>
                <project.encoding>UTF-8</project.encoding>
        </properties>

        <repositories>
                <repository>
                        <id>vaadin-addons</id>
                        <url>http://maven.vaadin.com/vaadin-addons</url>
                </repository>
                <repository>
                        <id>vaadin-snapshots</id>
                        <url>https://oss.sonatype.org/content/repositories/vaadin-snapshots/</url>
                        <releases>
                                <enabled>false</enabled>
                        </releases>
                        <snapshots>
                                <enabled>true</enabled>
                        </snapshots>
                </repository>
        </repositories>

        <dependencyManagement>
                <dependencies>
                        <dependency>
                                <groupId>com.vaadin</groupId>
                                <artifactId>vaadin-bom</artifactId>
                                <version>${vaadin.version}</version>
                                <type>pom</type>
                                <scope>import</scope>
                        </dependency>
                </dependencies>
        </dependencyManagement>

        <dependencies>
                <dependency>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                        <version>3.0.1</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</artifactId>
                        <scope>provided</scope>
                </dependency>
                <!--
                  Needed when using the widgetset optimizer (custom ConnectorBundleLoaderFactory).

                  For widgetset compilation, vaadin-client-compiler is automatically added on the
                  compilation classpath by vaadin-maven-plugin so normally there is no need for an
                  explicit dependency.
                -->
                <!--
                <dependency>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-client-compiler</artifactId>
                        <scope>provided</scope>
                </dependency>
                -->
                <dependency>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-themes</artifactId>
                </dependency>
                <dependency>
                        <groupId>com.vaadin</groupId>
                        <artifactId>vaadin-cdi</artifactId>
                        <version>1.0.3</version>
                        <type>jar</type>
                </dependency>
                <dependency>
                        <groupId>javax.enterprise</groupId>
                        <artifactId>cdi-api</artifactId>
                        <version>1.2</version>
                </dependency>
                <!-- DeltaSpike, overriding vaadin's implicit dependencies
                    for vaadin-cdi 1.0.3
                    see: https://github.com/vaadin/cdi/tree/master/vaadin-cdi -->
<!--
                <dependency>
                        <groupId>org.apache.deltaspike.core</groupId>
                        <artifactId>deltaspike-core-api</artifactId>
                        <version>1.3.0</version>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>org.apache.deltaspike.core</groupId>
                        <artifactId>deltaspike-core-impl</artifactId>
                        <version>1.3.0</version>
                        <scope>runtime</scope>
                </dependency>
-->
        </dependencies>

        <build>
                <plugins>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-compiler-plugin</artifactId>
                                <version>3.0</version>
                                <configuration>
                                        <encoding>${project.encoding}</encoding>
                                        <source>${project.source.version}</source>
                                        <target>${project.target.version}</target>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-resources-plugin</artifactId>
                                <version>2.6</version>
                                <configuration>
                                        <encoding>${project.encoding}</encoding>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-war-plugin</artifactId>
                                <version>2.3</version>
                                <configuration>
                                        <failOnMissingWebXml>false</failOnMissingWebXml>
                                        <!-- Exclude some unnecessary files generated by the GWT compiler. -->
                                        <packagingExcludes>WEB-INF/classes/VAADIN/gwt-unitCache/**,
                                                WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
                                </configuration>
                        </plugin>
                        <plugin>
                                <groupId>com.vaadin</groupId>
                                <artifactId>vaadin-maven-plugin</artifactId>
                                <version>${vaadin.plugin.version}</version>
                                <configuration>
                                        <extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
                                        <webappDirectory>${basedir}/target/classes/VAADIN/widgetsets</webappDirectory>
                                        <draftCompile>false</draftCompile>
                                        <compileReport>false</compileReport>
                                        <style>OBF</style>
                                        <strict>true</strict>
                                </configuration>
                                <executions>
                                        <execution>
                                                <goals>
                                                        <goal>update-widgetset</goal>
                                                        <goal>compile</goal>
                                                        <!-- disabled by default to use on-the-fly theme compilation -->
                                                        <!-- <goal>compile-theme</goal> -->
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-source-plugin</artifactId>
                                <version>2.4</version>
                        </plugin>
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-clean-plugin</artifactId>
                                <version>2.6.1</version>
                                <!-- Clean up also any pre-compiled themes -->
                                <configuration>
                                        <filesets>
                                                <fileset>
                                                        <directory>src/main/webapp/VAADIN/themes</directory>
                                                        <includes>
                                                                <include>**/styles.css</include>
                                                                <include>**/styles.scss.cache</include>
                                                        </includes>
                                                </fileset>
                                        </filesets>
                                </configuration>
                        </plugin>

                        <!-- The Jetty plugin allows us to easily test the development build by
                                running jetty:run on the command line. -->
                        <plugin>
                                <groupId>org.eclipse.jetty</groupId>
                                <artifactId>jetty-maven-plugin</artifactId>
                                <version>${jetty.plugin.version}</version>
                                <configuration>
                                    <scanIntervalSeconds>2</scanIntervalSeconds>
                                </configuration>
                        </plugin>
                </plugins>

                <pluginManagement>
                        <plugins>
                                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
                                <!-- TODO Remove when http://dev.vaadin.com/ticket/14924 is resolved -->
                                <plugin>
                                        <groupId>org.eclipse.m2e</groupId>
                                        <artifactId>lifecycle-mapping</artifactId>
                                        <version>1.0.0</version>
                                        <configuration>
                                                <lifecycleMappingMetadata>
                                                        <pluginExecutions>
                                                                <pluginExecution>
                                                                        <pluginExecutionFilter>
                                                                                <groupId>com.vaadin</groupId>
                                                                                <artifactId>
                                                                                        vaadin-maven-plugin
                                                                                </artifactId>
                                                                                <versionRange>[7.1.11,)</versionRange>
                                                                                <goals>
                                                                                        <goal>resources</goal>
                                                                                        <goal>update-widgetset</goal>
                                                                                        <goal>compile</goal>
                                                                                        <goal>compile-theme</goal>
                                                                                </goals>
                                                                        </pluginExecutionFilter>
                                                                        <action>
                                                                                <ignore></ignore>
                                                                        </action>
                                                                </pluginExecution>
                                                        </pluginExecutions>
                                                </lifecycleMappingMetadata>
                                        </configuration>
                                </plugin>
                        </plugins>
                </pluginManagement>

        </build>

</project>

1 回答

  • 0

    WEB-INF 中的(空) beans.xml 丢失了 .

相关问题