2 Replies Latest reply on Aug 5, 2015 6:51 AM by Jürgen Krauß

    Migration from JBOSS 7.1.1 to Wildfly 9: "WELD-001409: Ambiguous dependencies for type HttpServletRequest"

    Jürgen Krauß Newbie

      Hi,

      i try to deploy a .war file in Wildfly which run just fine in JBOSS 7.1.1.

       

      On startup i get this message

       

      2015-08-04 12:03:44,127 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "my-aktion.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"my-aktion.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"my-aktion.war\".WeldStartService: Failed to start service
          Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type HttpServletRequest with qualifiers @Default
        at injection point [BackedAnnotatedField] @Inject private de.dpunkt.myaktion.controller.SpendeFormEditController.req
        at de.dpunkt.myaktion.controller.SpendeFormEditController.req(SpendeFormEditController.java:0)
        Possible dependencies:
        - Producer Method [HttpServletRequest] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @RequestScoped de.dpunkt.myaktion.util.Resources.produceRequest()],
        - WELD%AbstractBuiltInBean%my-aktion.war/WEB-INF/classes%HttpServletRequest
      "}}
      2015-08-04 12:03:44,237 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 34) WFLYSRV0010: Deployed "my-aktion.war" (runtime-name : "my-aktion.war")
      2015-08-04 12:03:44,242 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
      WFLYCTL0186:   Services which failed to start:      service jboss.deployment.unit."my-aktion.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."my-aktion.war".WeldStartService: Failed to start service
      
      
      2015-08-04 12:03:44,651 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9991/management
      2015-08-04 12:03:44,653 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9991
      2015-08-04 12:03:44,653 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 9.0.1.Final (WildFly Core 1.0.1.Final) started (with errors) in 11371ms - Started 333 of 533 services (27 services failed or missing dependencies, 221 services are lazy, passive or on-demand)
      2015-08-04 12:03:44,694 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 2) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'my-aktion.war#primary'
      2015-08-04 12:03:44,698 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) WFLYWELD0010: Stopping weld service for deployment my-aktion.war
      2015-08-04 12:03:44,699 INFO  [org.jboss.as.jpa] (ServerService Thread Pool -- 2) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'my-aktion.war#primary'
      2015-08-04 12:03:44,776 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) WFLYJCA0010: Unbound data source [java:jboss/datasources/MyAktionDS]
      2015-08-04 12:03:44,820 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0028: Stopped deployment my-aktion.war (runtime-name: my-aktion.war) in 136ms
      2015-08-04 12:03:44,879 INFO  [org.jboss.as.repository] (DeploymentScanner-threads - 1) WFLYDR0002: Content removed from location C:\BPMLab\Server\MyAktion\wildfly-9.0.1.Final\standalone\data\content\1a\445d8ac40e98b635ba9b008313833d4f4c367d\content
      2015-08-04 12:03:44,881 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) WFLYSRV0009: Undeployed "my-aktion.war" (runtime-name: "my-aktion.war")
      2015-08-04 12:03:44,885 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) WFLYCTL0183: Service status report
      
      
      

       

      I'am new to this topic and don't see the problem. Can you please help me to solve this?

       

      Here my 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/maven-v4_0_0.xsd">
          <modelVersion>4.0.0</modelVersion>
      
      
        <groupId>de.dpunkt</groupId>
        <artifactId>my-aktion</artifactId>
        <version>1.0-SNAPSHOT</version>
        <packaging>war</packaging>
        <name>MyAktion – Spendenaktionen mit Java EE 7</name>
        <description>MyAktion ermöglicht die Abwicklung gemeinnütziger Spendenaktionen über das Web.</description>
      
      
          <properties>
              <!-- Explicitly declaring the source encoding eliminates the following
                  message: -->
              <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
                  resources, i.e. build is platform dependent! -->
              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
              <!-- Define the version of JBoss' Java EE 6 APIs and Tools we want
                  to import. -->
              <jboss.bom.version>1.0.0.Final</jboss.bom.version>
              <!-- Alternatively, comment out the above line, and un-comment the
                  line below to use version 1.0.0.M12-redhat-1 which is a release certified
                  to work with JBoss EAP 6. It requires you have access to the JBoss EAP 6
                  maven repository. -->
              <!-- <jboss.bom.version>1.0.0.M12-redhat-1</jboss.bom.version>> -->
          </properties>
      
      
      
      
          <dependencyManagement>
              <dependencies>
                  <!-- JBoss distributes a complete set of Java EE 6 APIs including
                      a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
                      a collection) of artifacts. We use this here so that we always get the correct
                      versions of artifacts. Here we use the jboss-javaee-6.0-with-tools stack
                      (you can read this as the JBoss stack of the Java EE 6 APIs, with some extras
                      tools for your project, such as Arquillian for testing) and the jboss-javaee-6.0-with-hibernate
                      stack you can read this as the JBoss stack of the Java EE 6 APIs, with extras
                      from the Hibernate family of projects) -->
                  <dependency>
                      <groupId>org.jboss.bom</groupId>
                      <artifactId>jboss-javaee-6.0-with-tools</artifactId>
                      <version>${jboss.bom.version}</version>
                      <type>pom</type>
                      <scope>import</scope>
                  </dependency>
                  <dependency>
                      <groupId>org.jboss.bom</groupId>
                      <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
                      <version>${jboss.bom.version}</version>
                      <type>pom</type>
                      <scope>import</scope>
                  </dependency>
              </dependencies>
          </dependencyManagement>
        
          <dependencies>
      
      
              <!-- First declare the APIs we depend on and need for compilation.
                  All of them are provided by JBoss AS 7 -->
      
      
              <!-- Import the CDI API, we use provided scope as the API is included
                  in JBoss AS 7 -->
              <dependency>
                  <groupId>javax.enterprise</groupId>
                  <artifactId>cdi-api</artifactId>
                  <scope>provided</scope>
              </dependency>
      
      
              <!-- Import the Common Annotations API (JSR-250), we use provided
                  scope as the API is included in JBoss AS 7 -->
              <dependency>
                  <groupId>org.jboss.spec.javax.annotation</groupId>
                  <artifactId>jboss-annotations-api_1.1_spec</artifactId>
                  <scope>provided</scope>
              </dependency>
      
      
              <!-- Import the JAX-RS API, we use provided scope as the API is included
                  in JBoss AS 7 -->
              <dependency>
                  <groupId>org.jboss.spec.javax.ws.rs</groupId>
                  <artifactId>jboss-jaxrs-api_1.1_spec</artifactId>
                  <scope>provided</scope>
              </dependency>
      
      
              <!-- Import the JPA API, we use provided scope as the API is included
                  in JBoss AS 7 -->
              <dependency>
                  <groupId>org.hibernate.javax.persistence</groupId>
                  <artifactId>hibernate-jpa-2.0-api</artifactId>
                  <scope>provided</scope>
              </dependency>
      
      
              <!-- Import the EJB API, we use provided scope as the API is included
                  in JBoss AS 7 -->
              <dependency>
                  <groupId>org.jboss.spec.javax.ejb</groupId>
                  <artifactId>jboss-ejb-api_3.1_spec</artifactId>
                  <scope>provided</scope>
              </dependency>
      
      
              <!-- JSR-303 (Bean Validation) Implementation -->
              <!-- Provides portable constraints such as @Email -->
              <!-- Hibernate Validator is shipped in JBoss AS 7 -->
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-validator</artifactId>
                  <scope>provided</scope>
                  <exclusions>
                      <exclusion>
                          <groupId>org.slf4j</groupId>
                          <artifactId>slf4j-api</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>
      
      
              <!-- Import the JSF API, we use provided scope as the API is included
                  in JBoss AS 7 -->
              <dependency>
                  <groupId>org.jboss.spec.javax.faces</groupId>
                  <artifactId>jboss-jsf-api_2.1_spec</artifactId>
                  <scope>provided</scope>
              </dependency>
      
      
              <!-- Now we declare any tools needed -->
      
      
              <!-- Annotation processor to generate the JPA 2.0 metamodel classes
                  for typesafe criteria queries -->
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-jpamodelgen</artifactId>
                  <scope>provided</scope>
              </dependency>
      
      
              <!-- Annotation processor that raising compilation errors whenever
                  constraint annotations are incorrectly used. -->
              <dependency>
                  <groupId>org.hibernate</groupId>
                  <artifactId>hibernate-validator-annotation-processor</artifactId>
                  <scope>provided</scope>
              </dependency>
      
      
              <!-- Needed for running tests (you may also use TestNG) -->
              <dependency>
                  <groupId>junit</groupId>
                  <artifactId>junit</artifactId>
                  <scope>test</scope>
              </dependency>
      
      
              <!-- Optional, but highly recommended -->
              <!-- Arquillian allows you to test enterprise code such as EJBs and
                  Transactional(JTA) JPA from JUnit/TestNG -->
              <dependency>
                  <groupId>org.jboss.arquillian.junit</groupId>
                  <artifactId>arquillian-junit-container</artifactId>
                  <scope>test</scope>
              </dependency>
      
      
              <dependency>
                  <groupId>org.jboss.arquillian.protocol</groupId>
                  <artifactId>arquillian-protocol-servlet</artifactId>
                  <scope>test</scope>
              </dependency>
      
      
        <dependency>
        <groupId>org.jboss.spec.javax.transaction</groupId>
        <artifactId>jboss-transaction-api_1.1_spec</artifactId>
        <scope>provided</scope>
        </dependency>
      
      
        <dependency>
        <groupId>org.jboss.spec.javax.servlet</groupId>
        <artifactId>jboss-servlet-api_3.0_spec</artifactId>
        <scope>provided</scope>
        </dependency>
      
      
        <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>3.5</version>
        </dependency>
      
          </dependencies>
      
      
          <build>
              <!-- Maven will append the version to the finalName (which is the
                  name given to the generated war, and hence the context root) -->
              <finalName>${project.artifactId}</finalName>
              <plugins>
                  <!-- Compiler plugin enforces Java 1.6 compatibility and activates
                      annotation processors -->
                  <plugin>
                      <artifactId>maven-compiler-plugin</artifactId>
                      <version>2.3.1</version>
                      <configuration>
                          <source>1.6</source>
                          <target>1.6</target>
                      </configuration>
                  </plugin>
                  <plugin>
                      <artifactId>maven-war-plugin</artifactId>
                      <version>2.1.1</version>
                      <configuration>
                          <!-- Java EE 6 doesn't require web.xml, Maven needs to
                              catch up! -->
                          <failOnMissingWebXml>false</failOnMissingWebXml>
                      </configuration>
                  </plugin>
                  <!-- The JBoss AS plugin deploys your war to a local JBoss AS
                      container -->
                  <!-- To use, run: mvn package jboss-as:deploy -->
                  <plugin>
                      <groupId>org.jboss.as.plugins</groupId>
                      <artifactId>jboss-as-maven-plugin</artifactId>
                      <version>7.1.1.Final</version>
                  </plugin>
              </plugins>
          </build>
      
      
          <profiles>
              <profile>
                  <!-- The default profile skips all tests, though you can tune
                      it to run just unit tests based on a custom pattern -->
                  <!-- Seperate profiles are provided for running all tests, including
                      Arquillian tests that execute in the specified container -->
                  <id>default</id>
                  <activation>
                      <activeByDefault>true</activeByDefault>
                  </activation>
                  <build>
                      <plugins>
                          <plugin>
                              <artifactId>maven-surefire-plugin</artifactId>
                              <version>2.4.3</version>
                              <configuration>
                                  <skip>true</skip>
                              </configuration>
                          </plugin>
                      </plugins>
                  </build>
        <repositories>
        <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
        </repository>
        </repositories>
              </profile>
      
      
              <profile>
                  <!-- An optional Arquillian testing profile that executes tests
                      in your JBoss AS instance -->
                  <!-- This profile will start a new JBoss AS instance, and execute
                      the test, shutting it down when done -->
                  <!-- Run with: mvn clean test -Parq-jbossas-managed -->
                  <id>arq-jbossas-managed</id>
                  <dependencies>
                      <dependency>
                          <groupId>org.jboss.as</groupId>
                          <artifactId>jboss-as-arquillian-container-managed</artifactId>
                          <scope>test</scope>
                      </dependency>
                  </dependencies>
        <repositories>
        <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
        </repository>
        </repositories>
              </profile>
      
      
              <profile>
                  <!-- An optional Arquillian testing profile that executes tests
                      in a remote JBoss AS instance -->
                  <!-- Run with: mvn clean test -Parq-jbossas-remote -->
                  <id>arq-jbossas-remote</id>
                  <dependencies>
                      <dependency>
                          <groupId>org.jboss.as</groupId>
                          <artifactId>jboss-as-arquillian-container-remote</artifactId>
                          <scope>test</scope>
                      </dependency>
                  </dependencies>
        <repositories>
        <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
        </repository>
        </repositories>
              </profile>
      
      
              <profile>
                  <!-- When built in OpenShift the 'openshift' profile will be
                      used when invoking mvn. -->
                  <!-- Use this profile for any OpenShift specific customization
                      your app will need. -->
                  <!-- By default that is to put the resulting archive into the
                      'deployments' folder. -->
                  <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
                  <id>openshift</id>
                  <build>
                      <plugins>
                          <plugin>
                              <artifactId>maven-war-plugin</artifactId>
                              <version>2.1.1</version>
                              <configuration>
                                  <outputDirectory>deployments</outputDirectory>
                                  <warName>ROOT</warName>
                              </configuration>
                          </plugin>
                      </plugins>
                  </build>
        <repositories>
        <repository>
        <id>prime-repo</id>
        <name>PrimeFaces Maven Repository</name>
        <url>http://repository.primefaces.org</url>
        <layout>default</layout>
        </repository>
        </repositories>
              </profile>
      
      
          </profiles>
      </project>
      
      
      

       

      Greetings

      J.Krauß