Hello; happy holidays.
I have created a local stateless session bean.
It implements a local business interface that includes, among other things:
// Not clear on whether @Observes needs to be here
public void processSessionBean(@Observes final ProcessSessionBean event);
It implements it like this:
@Override
public void processSessionBean(@Observes final ProcessSessionBean event) {
if (event != null) {
if (this.logger != null && this.logger.isLoggable(Level.INFO)) {
this.logger.logp(Level.INFO, CommonBeanManagerBean.class.getName(),
"processSessionBean", "Processing session bean event: {0}", event);
} else {
System.out.println("******** Processing session bean event: " +
event);
}
}
}
This bean is in a .jar file which is an EJB module. The interface is in a
.jar file.
The EJB module lives at the root of our .ear. The interface .jar file
lives within the lib directory of the .ear.
The EJB module has a META-INF/beans.xml file. The interface .jar file does
not.
The observer method never fires.
I've tried this with the @Observes annotation present on:
- the interface only
- the class only
- both the class and the interface
...since it is not clear from the CDI specification whether the CDI
provider is looking at the bean class, the proxy or the business interface
for the fact that this is an observer method.
In one permutation, I had omitted this method from the business interface,
and Weld helpfully chimed in that it had detected an observer method on my
bean class, but that (as the spec says) it was not an implementation of
anything in the business interface. So this told me that Weld at least
"sees" the @Observes annotation sometimes.
What am I missing or doing wrong?
Thanks,
Best,
Laird
--
http://about.me/lairdnelson