EJB3 - method not a post-construct method of EJB interceptor

171 views Asked by At

My @PostConstruct method meets all of the rules, but I still get the error that the method is not a post-construct method of EJB interceptor.

It's return is void. It does not throw exceptions. It does not take arguments.

Does anyone know of another reason that this error can occur?

import javax.annotation.PostConstruct;
...
    @PostConstruct
    public void init() {
        getReferences();
    }
1

There are 1 answers

0
Amit On

The method MUST NOT have any parameters except in the case of EJB interceptors in which case it takes an InvocationContext object as defined by the EJB specification.

As you have mentioned it is an EJB interceptor, I believe you need to add a parameter for InvocationContext.