Static module : org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies

Posted on

Hello all,

I'm working with JBoss-EAP-6.3 and I've got a problem with a static module creation.

A project deployed in the JBOSS has a library (config-util.jar) in its lib folder.

my-ear.ear
|_ my-ejb.jar
|
|_ / lib
|_ config-util.jar

The config-util.jar library uses the @Produces CDI annotation in a class :

@ApplicationScoped
public class ConfigMger {

    @Inject
    private ConfigReg configRegistry;

    @Produces
    @Dependent
    public Properties get(InjectionPoint ip) {
        Config config = ip.getAnnotated().getAnnotation(Config.class);
        return configRegistry.get(config.value());
    }
}

This class is injected in the ejb module my-ejb.jar and both of jars have the META-INF/beans.xml file.
Everything works fine but we would like to use this library for another projects.
That's why it should be great to transform the library into JBoss static module.

I created the mdule with all dependencies, however when I try to start JBOSS with the new module I always have this error message :

org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Properties] with qualifiers [@Default] at injection poin
t [[field] @Config @Inject private com.proxy.ProxyFactory.config]

This is the config-util.jar module.xml file :

<module xmlns="urn:jboss:module:1.1" name="com.config.config-util" slot="1.0.0">
    <resources>
        <resource-root path="config-util-1.0.0.jar" />
    </resources>
    <dependencies>
        <module name="javax.api" export="true" />
  <module name="javax.enterprise.api" export="true" />
  <module name="org.jboss.weld.spi" export="true" />
        <module name="org.apache.log4j" export="false" />
    </dependencies>
</module>

This is a part of the jboss-deployment-structure.xml file contained into my-ear.ear :

<jboss-deployment-structure>
    <deployment>
        <dependencies>
            <module name="com.config.config-util" export="true" slot="1.0.0" />
        </dependencies>
    </deployment>
  ...
</jboss-deployment-structure>

I assume there is a problem with the WELD analysis of the static module but I don't know what I have to do...
Anybody can help me?

Thanks in advance.

Nicolas

Responses