1

I have a problem when I try to deploy my app in Wildfly 10.

The problem refer to dependency injection for an interface.

My app is a maven multi-module project. The interface and the dependency injection are in the same module. I have already the same problem with an other interface placed in an other module (the injection is made in the same class as for the current problem).

My module is deployed in a war package (This is that i try to deploy). My project is deployed in an unique ear package.

Error :

"{\"WFLYCTL0080: Failed services\" => {\"jboss.deployment.unit.\\\"myApp-0.0.1-SNAPSHOT.war\\\".component.SpecificDataListener.WeldInstantiator\" => \"org.jboss.msc.service.StartException in service jboss.deployment.unit.\\\"myApp-0.0.1-SNAPSHOT.war\\\".component.SpecificDataListener.WeldInstantiator: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type IMsgPoolManager with qualifiers @Default
  at injection point [BackedAnnotatedField] @Inject private fr.gateway.controller.impl.SpecificDataListener.messagePoolManager
  at fr.gateway.controller.impl.SpecificDataListener.messagePoolManager(SpecificDataListener.java:0)
\"}}"

Interface :

import eu.datamodel.entity.Entity;

public interface IMsgPoolManager {

    void sendCiseMessage(Entity myObject);
    
}

Injection :

@MessageDriven(mappedName = "topic/specificdatato", activationConfig = {
        @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge"),
        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Topic"),
        @ActivationConfigProperty(propertyName = "destination", propertyValue = "topic/specificdatato"),
        @ActivationConfigProperty(propertyName = "clientId", propertyValue = "specificdatato") })
public class SpecificDataListener implements MessageListener {
    
    private static Logger LOGGER = LoggerFactory.getLogger(SpecificDataListener.class);
    
    @Inject
    public IMsgPoolManager messagePoolManager;
   
    /** Some code **/

}

beans.xml :

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee 
       http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
       bean-discovery-mode="all">
</beans>

pom.xml

<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <modelVersion>4.0.0</modelVersion>
  
    <parent>
        <groupId>fr</groupId>
        <artifactId>myParentApp</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
  
    <artifactId>myApp</artifactId>
    <name>myApp</name>
    <packaging>war</packaging>
  
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    
  <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <archive>
                        <manifestEntries>
                            <Dependencies>org.mongodb</Dependencies>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
  
    <dependencies>
        
        <!-- JAVAX dependencies -->     
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0.1</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1<version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>javax.ejb</groupId>
            <artifactId>javax.ejb-api</artifactId>
            <version>3.2<version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2<version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>javax.enterprise</groupId>
            <artifactId>cdi-api</artifactId>
            <version>1.2</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>javax.enterprise.concurrent</groupId>
            <artifactId>javax.enterprise.concurrent-api</artifactId>
            <version>1.0<version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1<version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

I have tried a lot of solutions found on the internet, but the error still occurs...

David Lukas
  • 1,184
  • 2
  • 8
  • 21
Laso83
  • 11
  • 2
  • Where is the implementation of `IMsgPoolManager`? In which Maven module is it located, how is it annotated, what is the beans.xml of that module? – Nikos Paraskevopoulos Dec 02 '21 at 09:34
  • The implementation od IMsgPoolManager is in the same package of SpecificDataListener and IMsgPoolManager, in the same module. The beans.xml is the file descibed in the question. The implementation is annotated Startup and Singleton – Laso83 Dec 02 '21 at 09:40
  • Okay, sorry, the implementation isn't annotated singleton and now that's working. But now I've a similar problem with a simple class who try to inject some String fields. The class is annotated startup and singleton. The module have the same beans.xml as in the question. I've the following error : ```WELD-001475: The following beans match by type, but none have matching qualifiers: - Producer Method [String] with qualifiers [BatchProperty Any] declared as [[UnbackedAnnotatedMethod] Produces BatchProperty public org.jberet.creation.BatchBeanProducer.getString(InjectionPoint)] "}}``` – Laso83 Dec 02 '21 at 10:11

0 Answers0