错误而在JBOSS 5.0.1访问ServicePOJO

我有一个EJB和ServicePOJOs web应用。 当我试图访问这些的POJO之一,我得到以下错误:

java.lang.NullPointerException at com.sonydadc.MyAPP.pa.server.PA_Bean.getServername(PA_Bean.java:539) at org.apache.jsp.templates.start_jsp._jspService(start_jsp.java:104) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638) at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:543) at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:480) at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:968) at org.apache.jsp.login.login_jsp._jspService(login_jsp.java:101) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:638) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:444) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:382) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:310) at org.apache.catalina.authenticator.FormAuthenticator.forwardToLoginPage(FormAuthenticator.java:316) at org.apache.catalina.authenticator.FormAuthenticator.authenticate(FormAuthenticator.java:244) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:491) at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126) at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619)

我的系统:在Jboss 5.0.1 EJB 3.0的MyFaces 1.1

任何人都可以提供一些资料?

更新:这里来了代码:这是我怎么注入POJO对象

@EJB(mappedName = "service/ServPOJOBean") @IgnoreDependency private ServPOJOBean mb;

这是这将导致NullPointerException异常的线路:

mb.getValue("servername");

奇怪的是:它的工作原理,当我抬头看ServicePOJO是这样的:

MBeanServer server = MBeanServerLocator.locate(); ServPOJOBean mb = (ServPOJOBean) MBeanProxyExt. create(ServPOJOBean.class, "jboss:service=ServPOJOBean");

更新

这是我definedthe ServicePoJO类:

@Service(objectName = "jboss:service=ServPOJOBean") @Management(ServPOJOBean.class) @Local(ServPOJOBean.class) @LocalBinding(jndiBinding = "service/ServPOJOBean") public class ServPOJOBeanImpl implements ServPOJOBean { ... }

--------------解决方案-------------

的问题是,注射用的服务@EJB注解当前失败,因此NullPointerException 。 说实话,我当时甚至不知道这是可能的 - 根据以下链接它似乎是一个“推广的”EJB 3所以它应该是 - 但如果它是,仔细检查远程接口的JNDI名称。 也许显示您的服务POJO的代码。

参考

  • 第28章服务的POJO(EJB3的JBoss的扩展)
  • 使用部署描述符第29章服务的POJO(EJB3的JBoss的扩展)
分类:java的 时间:2015-03-15 人气:0
分享到:

相关文章

Copyright (C) 55228885.com, All Rights Reserved.

55228885 版权所有 京ICP备15002868号

processed in 2.606 (s). 10 q(s)