A Java EE 6 project using the JSF 2.x mojarra implementation (both for testing 2.0 and 2.1), where the beans session is injected via @EJB annotations into JSF-managed beans crashing in WebSphere Application Server 8.5, while it runs on Glassfish 3. x (tested on GF 3.0 and 3.1, respectively):
The coding approach is as follows:
SomeEJBFacade.java
@Stateless public class SomeEJBFacade() { public String testMethod() { return "testing 1 2 3"; } }
Testbean
@ManagedBean @ViewScoped public class TestBean implements java.io.Serializable { @EJB SomeEJBFacade facade; public String getTestStr() { return facade.testMethod(); } }
JSF wrapper snippet:
<h:outputText value="#{testBean.testStr}" />
the above leads to a Null Pointer Exception from the TestStr () method of TestBean.
Similarly, any transactional JPA method throws null-pointer exceptions to similar items.
source share