In the Contexts and Dependency Injection (CDI) 1.0 OpenWebBeans implementation, an application can start
successfully
even if non-static fields with the @Produces annotation are declared in session bean classes,
even though that behavior does not comply with the CDI 1.0 specification.
In the CDI 1.2 Weld implementation, the application does not start and throws the following exception:
WELD-000096: Producer fields on session beans must be static. Field [{0}] declared on [{1}].
You can resolve this problem by adding the static modifier to the producer fields on session beans.
This rule flags non-static fields with the @Produces annotation declared in session bean
classes.
The following elements and annotations define a class as a session bean:
ejb-jar.xml filesejb-jar.xml filesejb-jar.xml files@Singleton, @Stateless, or @Stateful annotation on the class
declarationAn automated fix exists to address these issues in the application. This fix can be applied by copying the custom configuration into your application build file.
For more information, see the following resources: