JBoss:为servlet-NPE java分配异常

时间:2014-12-30 12:10:23

标签: java servlets jboss

当我尝试使用MyRestApi类时,我收到此错误消息。它注入了具有@EJB的ServiceHelper。可能是MyStestApi类没有选择EJB注释类中使用的方法。

 2014-12-30 13:26:50,648 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/mali].[com.company.mali.api.MyRestApi]] Allocate exception for servlet com.company.mali.api.MyRestApi: 
java.lang.NullPointerException
    at org.jboss.as.weld.services.bootstrap.WeldEjbInjectionServices.resolveEjb(WeldEjbInjectionServices.java:92) [jboss-as-weld-7.1.3.Final.jar:7.1.3.Final]
    at org.jboss.weld.util.Beans.injectEEFields(Beans.java:603) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1$1.proceed(ManagedBean.java:160) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget$1.work(ManagedBean.java:157) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.weld.bean.ManagedBean$FixInjectionPoint.run(ManagedBean.java:131) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.weld.bean.ManagedBean$ManagedBeanInjectionTarget.inject(ManagedBean.java:153) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.resteasy.cdi.JaxrsInjectionTarget.inject(JaxrsInjectionTarget.java:36) [resteasy-cdi-2.3.3.Final.jar:]
    at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:293) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:103) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:79) [weld-core-1.1.9.Final.jar:2012-08-06 19:12]
    at com.company.mali.api.MyRestApi$Proxy$_$$_WeldClientProxy.getClasses(MyRestApi$Proxy$_$$_WeldClientProxy.java) [classes:]
    at org.jboss.resteasy.spi.ResteasyDeployment.processApplication(ResteasyDeployment.java:448) [resteasy-jaxrs-2.3.3.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:294) [resteasy-jaxrs-2.3.3.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:225) [resteasy-jaxrs-2.3.3.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:67) [resteasy-jaxrs-2.3.3.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) [resteasy-jaxrs-2.3.3.Final.jar:]
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.17.Final.jar:]
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:952) [jbossweb-7.0.17.Final.jar:]
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:188) [jbossweb-7.0.17.Final.jar:]
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.17.Final.jar:]
    at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165) [jboss-as-web-7.1.3.Final.jar:7.1.3.Final]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.17.Final.jar:]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.17.Final.jar:]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.17.Final.jar:]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372) [jbossweb-7.0.17.Final.jar:]
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.17.Final.jar:]
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.17.Final.jar:]
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.17.Final.jar:]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_55]

The MessageDrivenBean in ServiceHelper
    @EJB( beanName="MyMdb",beanInterface=MyMdb.class,lookup = "com.company.mali.mdb.MyMdb/local")
    private MyMdb MyMdb;

The injection in MyRestApi class
    @Inject
    private  ServiceHelper helper;

0 个答案:

没有答案