WLS 12.1.1: No Warning for @PostConstruct Method with No Parameter in Interceptor Class (Doc ID 1475812.1)

Last updated on NOVEMBER 05, 2016

Applies to:

Oracle Weblogic Server - Version 12.1.1.0 to 12.1.1.0 [Release 12c]
Information in this document applies to any platform.

Symptoms

In WLS 10.3.6, when the @PostConstruct method in EJB Interceptor Class has no parameter, it throws exception, as below:

java.lang.IllegalArgumentException: Method "init" in class "org.example.test.interceptor.MyInterceptor" is defined as lifecycle callback method with annotation
@PostConstruct, but it should take an InvocationContext object as parameter in the case of EJB interceptor.
  at weblogic.j2ee.dd.xml.validator.lifecyclecallback.BaseValidator.error(BaseValidator.java:206)
  at weblogic.j2ee.dd.xml.validator.lifecyclecallback.BaseValidator.error(BaseValidator.java:229)
  at weblogic.j2ee.dd.xml.validator.lifecyclecallback.InterceptorValidator.checkParameters(InterceptorValidator.java:53)
  at weblogic.j2ee.dd.xml.validator.AbstractAnnotationValidator.checkMethod(AbstractAnnotationValidator.java:65)
  at weblogic.j2ee.dd.xml.validator.AbstractAnnotationValidator.validate(AbstractAnnotationValidator.java:31)
  at weblogic.j2ee.dd.xml.validator.AnnotationValidatorVisitor.visitLifeCycleCallbackBean(AnnotationValidatorVisitor.java:37)
  at weblogic.j2ee.dd.xml.validator.AnnotationValidatorVisitor.visit(AnnotationValidatorVisitor.java:24)
  at weblogic.descriptor.internal.AbstractDescriptorBean.accept(AbstractDescriptorBean.java:1325)
  at weblogic.descriptor.internal.AbstractDescriptorBean.accept(AbstractDescriptorBean.java:1329)
  at weblogic.descriptor.internal.AbstractDescriptorBean.accept(AbstractDescriptorBean.java:1329)

 However, in WLS 12.1.1, no exception is thrown, and the the class will be deployed successfully.  This difference in behavior looks to have broken the EJB 3.0 spec.

 

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms