Announcement Announcement Module
Collapse
No announcement yet.
EJB3: SpringBeanAutowiringInterceptor @PostConstruct never called Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • EJB3: SpringBeanAutowiringInterceptor @PostConstruct never called

    I've been attempting to get a spring wired EJB3 SLSB to deploy in JBoss 4.2.2.GA for 2 days now. It is not working but I think I've found why. The SpringBeanAutowiringInterceptor uses the PostConstruct annotation to perform the wiring. However, PostConstruct annotated methods are not called on interceptors in JBoss. I'm not sure how this ever worked it if did, but I'm almost 100% certain that it doesn't work on a standard JBoss 4.2.2.GA default server from within an EAR.

    EAR structure:
    Code:
    ear
      APP-INF/lib/tons-o-jars
                     /core-stuff.jar
                       beanRefContext.xml
                       META-INF
                         MANIFEST.MF (with classpath set to use APP-INF/lib)
      mywar.war
        META-INF
          MANIFEST.MF (with classpath set to use APP-INF/lib)
      myejb.jar
        META-INF
          MANIFEST.MF (with classpath set to use APP-INF/lib)
    The WAR works great. The shared application context is picked up no problem. No issues there. The EJB is deployed and reports as such in the JBoss JMX Console and stdout. However, when running a test to hit the EJB remotely I get NullPointerExceptions from the EJB because its dependency was never autowired.

    So, I grabbed the source of the SpringBeanAutowiringInterceptor, threw in a bunch of logging statements, and applied it to my EJB. Wouldn't you know it, the PostConstruct is never executed and the EJB is never wired. In fact, no method is ever called.

    I think the correct way to use an Interceptor is with the @AroundInvoke annotations.

    Please correct me if I'm wrong. Otherwise I'll submit a bug.

    Thanks,
    T
Working...
X