Uploaded image for project: 'JBoss Transaction Manager'
  1. JBoss Transaction Manager
  2. JBTM-3905

(6.0.) Declare no-arg constructor to TMApplication

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Done
    • Icon: Minor Minor
    • 6.0.3.Final
    • 6.0.1.Final
    • REST
    • None

      From Jakarta EE cdi specification:
      If a bean class does not explicitly declare a constructor using @Inject, the constructor that accepts
      no parameters is the bean constructor.

      This is needed only for bean classes (i.e. annotated as @ApplicationScoped ) and the TMApplication is not annotated. However it is possible that a project uses 'all' as bean-discovery-mode and 'not having a no-arg constructor or a constructor with @Inject annotation' might be a problem. Therefore I recommend having a no-arg constructor and/or an @Inject constructor.

      related issue is https://github.com/eclipse/lsp4jakarta/issues/191

      Note 1: The existing constructor cannot be annotated with @Inject because the parameters must be injectable as well according to the spec

      Note 2: only recently the default bean-discovery-mode has changed to 'annotated' (CDI 4 https://jakarta.ee/specifications/cdi/4.0/jakarta-cdi-spec-4.0.html#_jakarta_contexts_and_dependency_injection_4_0 )

      Note 3: I got an error on a quarkus-resteasy quickstart related to this issue:

      Build step
      io.quarkus.resteasy.server.common.deployment.ResteasyServerCommonProcessor#build
      threw an exception: java.lang.RuntimeException: Unable to handle class:
      org.jboss.jbossts.star.service.TMApplication

      [ERROR] Caused by: java.lang.NoSuchMethodException:
      org.jboss.jbossts.star.service.TMApplication.<init>()
      [ERROR] at
      java.base/java.lang.Class.getConstructor0(Class.java:3585)
      [ERROR] at
      java.base/java.lang.Class.getConstructor(Class.java:2271)
      [ERROR] at
      io.quarkus.resteasy.server.common.deployment.ResteasyServerCommonProcessor.getAllowedClasses(ResteasyServerCommonProcessor.java:1010)

              rh-ee-msappegr Marco Sappe Griot
              rh-ee-msappegr Marco Sappe Griot
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: