GovernIB / projectebase

Projecte Base - JBoss 7.2 EAP & Open JDK 11
4 stars 0 forks source link

Problemes amb el desplegament del mòdul de Notib #148

Closed acuevas-dgtic closed 1 year ago

acuevas-dgtic commented 2 years ago

Al desplegar surt l'error:

WELD-001410: The injection point has non-proxyable dependencies: [BackedAnnotatedParameter] parameter 1 of [BackedAnnotatedConstructor] @Inject public es.caib.baleartic.notib.NotificacioController(NotificacioRestClientV2) at es.caib.baleartic.notib.NotificacioController.<init>(NotificacioController.java:0)

StackTrace

Caused by: org.jboss.weld.exceptions.UnproxyableResolutionException: WELD-001435: Normal scoped bean class es.caib.notib.client.NotificacioRestClientV2 is not proxyable because it has no no-args constructor - Producer Method [NotificacioRestClientV2] with qualifiers [@Any @Default] declared as [[BackedAnnotatedMethod] @Produces @ApplicationScoped public es.caib.baleartic.notib.ClientNotibProducer.getNotificacioRestClient(Configuracio)]."}}

Pareix que el problema està en la classe Configuracio, està ApplicationScoped a dos llocs diferents i crea el conflicte.

gdeignacio-fundaciobit commented 1 year ago

La classe NotificacioRestClientV2 no disposa d'un constructor sense arguments per al métode ClientNotibProducer#getNotificacioRestClient(Configuracio). S'ha inicialitzat el client al propi controller amb @PostConstruct init() i es recomana no fer servir ClientNotibProducer amb la versió actual de Notib.

gdeignacio-fundaciobit commented 1 year ago

Es recomana al controller

` @Inject private Configuracio configuracio;

private NotificacioRestClientV2 client;

@PostConstruct
protected void init() {
    LOG.info("Iniciant client");
    client = NotificacioRestClientFactory.getRestClientV2(
        configuracio.getEndpoint(),
        configuracio.getUsuari(),
        configuracio.getSecret());
    LOG.info("Client creat");
}

`