-
Bug
-
Resolution: Done
-
Major
-
2.3.2.Final
-
None
-
None
import javax.ejb.Stateless; import javax.enterprise.inject.spi.InjectionPoint; import javax.inject.Inject; @Stateless public class StatelessBean { private InjectionPoint injectionPoint; public StatelessBean() { super(); } @Inject protected void inject(InjectionPoint injectionPoint) { this.injectionPoint = injectionPoint; } public InjectionPoint getInjectionPoint() { return injectionPoint; } }
Having the above posted bean and a servlet which @Inject StatelessBean statelessBean, then calling:
statelessBean.getInjectionPoint().toString());
will result in a NPE. The bean, however, is injected.
Here is a stacktrace with the NPE:
13:39:34,409 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /injectIntoStateless/testservlet: java.lang.NullPointerException at org.jboss.weld.injection.ForwardingInjectionPoint.toString(ForwardingInjectionPoint.java:60) at org.jboss.weld.injection.ForwardingInjectionPoint.toString(ForwardingInjectionPoint.java:60) at com.ibm.jcdi.test.TestServlet.doGet(TestServlet.java:37) at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)
Debugging shows that there is no specific implementation of toString method in ForwardingInjectionPoint (and any subclasses).
Adding toString implementation to SerializableForwardingInjectionPoint will make the NPE go away.
We also need to investigate if this is the case with other beans (not just stateless).