I have an .ear file.
The .ear file contains an EJB module.
The EJB module contains a META-INF/services/javax.enterprise.inject.spi.Extension file.
That file's first line names a class of mine that implements javax.enterprise.inject.spi.Extension.
The EJB module also contains an empty META-INF/beans.xml file.
My standard extension contains the following method (the this.beanManager reference is declared as @Inject private BeanManager beanManager;):
[code]
public void afterDeploymentValidation(@Observes final AfterDeploymentValidation event) {
if (this.beanManager != null) {
final Set<Bean<?>> beans = this.beanManager.getBeans(Foo.class);
System.out.println("*** Beans: " + beans);
if (beans != null && !beans.isEmpty()) {
for (final Bean<?> bean : beans) {
if (bean != null) {
final Class<?> beanClass = bean.getBeanClass();
System.out.println("*** Bean class: " + beanClass);
}
}
}
} else {
System.out.println("*** No bean manager injected");
}
}
[/code]
It was my understanding that such a setup should cause my standard extension to be instantiated and run after successful deployment completes.
No message starting with "***" is ever output to the log.
Is there an obvious pilot error here, or have I somehow violated the CDI specification, or...? Should my META-INF/services file be at the .ear file root instead? How is this supposed to work?
I am using Glassfish 3.1 build 9.
Thanks,
Laird
[Message sent by forum member 'ljnelson']
http://forums.java.net/jive/thread.jspa?messageID=477300