ejbcdiapache-tomeeopenejbmicroprofile

Tomee+Microprofile UnsatisfiedResolutionException


everybody!
Could you give me advice about such an issue.
I have a simple test project in order to test using Microprofile config.
Field of my test class I test:

   @Inject
   @ConfigProperty(name = "injected.value")
   private String injectedValue;

So this is the dependencies section of my pom:

<dependencies>
        <!-- https://mvnrepository.com/artifact/org.eclipse.microprofile/microprofile -->
        <dependency>
            <groupId>org.eclipse.microprofile</groupId>
            <artifactId>microprofile</artifactId>
            <version>3.3</version>
            <type>pom</type>
            <scope>provided</scope>
        </dependency>
</dependencies>

I build the war and then:
1. when i deploy war into the tomee 8.0.1-microprofile (tomee-maven-plugin with tomeeClassifier set up to microprofile) -> then all works OK.
2. BUT when i deploy war into the tomee 8.0.1-plus (tomee-maven-plugin with tomeeClassifier set up to plus) -> then i got exception:

org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [java.lang.String] is not found with the qualifiers 
Qualifiers: [@org.eclipse.microprofile.config.inject.ConfigProperty(name=injected.value, defaultValue=org.eclipse.microprofile.config.configproperty.unconfigureddvalue)]
for injection into Field Injection Point, field name :  injectedValue, Bean Owner : ...

More over in case 1 (deploy to tomee 8.0.1-microprofile) when i change pom dependencies to:

<dependencies>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.eclipse.microprofile.config</groupId>
            <artifactId>microprofile-config-api</artifactId>
            <version>1.4</version>
        </dependency>
</dependencies>

i got the error:

 org.apache.webbeans.exception.WebBeansDeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Api type [java.lang.String] is not found with the qualifiers 
Qualifiers: [@org.eclipse.microprofile.config.inject.ConfigProperty(name=injected.value, defaultValue=org.eclipse.microprofile.config.configproperty.unconfigureddvalue)]...

Please could anybody help me with this issue?
I need to use Microptofile in the prod and for now, I can't do it.


Solution

  • for the plus and plume version to work, you must include the following property in system.properties:

    tomee.mp.scan = all

    reference: http://tomee-openejb.979440.n4.nabble.com/MicroProfile-Integration-in-Plus-and-Plume-td4686818i60.html

    another way is using the tomee plugin and adding this property in pom.xml :

    <systemVariables>
           <tomee.mp.scan>all</tomee.mp.scan>
     </systemVariables>