If an ENC entry for java:/comp/EJBContext is declared and NO injection target is specified, this results in a NPE.
<resource-env-ref>
<resource-env-ref-name>EnvNameOfSessionContext</resource-env-ref-name>
<resource-env-ref-type>javax.ejb.SessionContext</resource-env-ref-type>
<mapped-name>java:comp/EJBContext</mapped-name>
</resource-env-ref>
The exception is:
...
Caused by: java.lang.NullPointerException
at org.jboss.injection.InjectionUtil.createInjectors(InjectionUtil.java:105)
at org.jboss.injection.ResourceHandler.loadXmlResourceEnvRefs(ResourceHandler.java:227)
at org.jboss.injection.ResourceHandler.loadXml(ResourceHandler.java:343)
at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:597)
at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:434)
at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:543)
... 69 more
Looking at the code in ResourceHandler.loadXmlResourceEnvRefs, this is the only place where the check "if(envRef.getInjectionTargets() != null)" is missing .
I will attach a sample.