subha
subha

Reputation: 1

WELD Exception while Migrating to Jboss EAP7

I'm facing the following exception while migrating to JBOSS EAP 7.3 from EAP 6.4.9.

ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 72) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "xxx.war")]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"xxx.war\".WeldStartService" => "Failed to start service Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000805: Cannot have more than one post construct method annotated with @PostConstruct for [EnhancedAnnotatedTypeImpl] public @ManagedBean class com.xxxx.xxxx.SampleManagedBean"}} ERROR [org.jboss.as.server] (ServerService Thread Pool -- 72) WFLYSRV0021: Deploy of deployment "xxxx.war" was rolled back with the following failure message: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"xxxx.war\".WeldStartService" => "Failed to start service Caused by: org.jboss.weld.exceptions.DefinitionException: WELD-000805: Cannot have more than one post construct method annotated with @PostConstruct for [EnhancedAnnotatedTypeImpl] public @ManagedBean class com.xxxx.xxxxx.SampleManagedBean"}}

It worked well in EAP6.4.The issue is occuring in EAP 7 and above versions. Any suggestions on this would do a great favor. Thanks in advance.

Upvotes: 0

Views: 671

Answers (1)

Aaron
Aaron

Reputation: 24802

The javadoc for @PostConstruct specifies that :

Only one method can be annotated with this annotation

The error log shows us JBoss EAP 7.3 complaining that the com.xxxx.xxxx.SampleManagedBean class has more than one such methods. I suggest creating a new method @PostConstruct in this class which would call the two other methods, from which the annotation should be removed.

This is not a bug of JBoss EAP 7.3 and I doubt you can avoid fixing the class.

Upvotes: 1

Related Questions