Uploaded image for project: 'TomEE'
  1. TomEE
  2. TOMEE-4350

mp-jwt: Add qualifier for produced Jsonb

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 10.0.0-M1, 9.1.3
    • 10.0.0-M2, 9.1.4
    • TomEE Core Server
    • None

    Description

      JsonbProducer currently produces an unqalified Jsonb, making it impossible for the application to define its own producer: https://github.com/apache/tomee/blob/tomee-project-10.0.0-M1/mp-jwt/src/main/java/org/apache/tomee/microprofile/jwt/cdi/JsonbProducer.java

       

      This results in the following deployment error when OWB starts up (reproducer attached):

      05-Jun-2024 15:48:31.010 SEVERE [main] org.apache.openejb.cdi.OpenEJBLifecycle.startApplication CDI Beans module deployment failed
      
              org.apache.webbeans.exception.WebBeansDeploymentException: jakarta.enterprise.inject.AmbiguousResolutionException: There is more than one Bean with type jakarta.json.bind.Jsonb Qualifiers: [@jakarta.enterprise.inject.Default()]
      
      for injection into Field Injection Point, field name :  jsonb, Bean Owner : [ExampleBean, WebBeansType:MANAGED, Name:null, API Types:[java.lang.Object,org.example.ExampleBean], Qualifiers:[jakarta.enterprise.inject.Default,jakarta.enter
      prise.inject.Any]]
      
      found beans:  
      Jsonb, WebBeansType:PRODUCERMETHOD, Name:null, API Types:[java.lang.Object,jakarta.json.bind.Jsonb,java.lang.AutoCloseable], Qualifiers:[jakarta.enterprise.inject.Default,jakarta.enterprise.inject.Any], Producer Method: public jakarta.j
      son.bind.Jsonb org.example.JsonbProducer.createJsonb() from file:/home/markus/tmp/tomee-jsonb-unqalified/target/apache-tomee/webapps/tomee-embedded-mp-1.0-SNAPSHOT/WEB-INF/classes/org/example/JsonbProducer.class
      
      Jsonb, WebBeansType:PRODUCERMETHOD, Name:null, API Types:[java.lang.Object,jakarta.json.bind.Jsonb,java.lang.AutoCloseable], Qualifiers:[jakarta.enterprise.inject.Default,jakarta.enterprise.inject.Any], Producer Method: public jakarta.j
      son.bind.Jsonb org.apache.tomee.microprofile.jwt.cdi.JsonbProducer.create() from jar:file:/home/markus/tmp/tomee-jsonb-unqalified/target/apache-tomee/lib/mp-jwt-10.0.0-M1.jar!/org/apache/tomee/microprofile/jwt/cdi/JsonbProducer.class
       

      Attachments

        1. reproducer.zip
          3 kB
          markus-jung

        Activity

          People

            jungm Markus Jung
            jungm Markus Jung
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 40m
                40m