I have a Singleton EJB (version of javax.ejb.Singleton. Sigh.) On which there is a CDI observer method. When I try to deploy this to Glassfish 3.1, the server will not be able to deploy the EAR file without any real explanation - just saying that during the deployment there was an exception without any details.
SEVERE: Exception while loading the app SEVERE: Exception while shutting down application container .... SEVERE: Exception while shutting down application container : java.lang.NullPointerException
This is the CDI event listener:
public void updateFromGranule(@Observes @CloudMask GranuleAvailableEvent granuleEvent) { LOG.info("updating cloud map"); update(granuleEvent.getGranule(), CloudMask.class); fireUpdate(); }
If I changed the Singleton bean to just be an @ApplicationScoped bean, the application deploys perfectly. Similarly, if I remove the CDI event observer method, the application will deploy fine. I really need a class that will be singleton EJB because I want transactions, thread safety, etc. EJB, so just leaving this as @ApplicationScoped POJO is not much for me. The problem doesn't seem to be limited to Singleton beans, though - I experimented by changing the annotation to @Stateless and @Stateful, and I get the same problem.
It seems to me that this may be a mistake in Weld, perhaps Weld and EJB are fighting about how they proxy this method - presumably EJB should add an interceptor class and wrap this method to ensure thread safety, and Weld is trying to do something else, to get an event listener to work?
I donβt understand something, and if CDI event handlers just wonβt be used in EJB (in this case there should be better error messages from glass fish) - or is it just a mistake in implementing CDI or EJB?
jportway
source share