[jboss-user] [EJB 3.0] - GetEJBObject NullPointerException

lydiachung do-not-reply at jboss.com
Thu Jan 25 14:07:25 EST 2007


I have problem when I try to get the object back from EJB Handle.

I got the following exception:

13:42:40,959 ERROR [STDERR] java.lang.NullPointerException
  | 13:42:40,959 ERROR [STDERR] 	at javax.naming.InitialContext.getURLScheme(Unknown Source)
  | 13:42:40,959 ERROR [STDERR] 	at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
  | 13:42:40,959 ERROR [STDERR] 	at javax.naming.InitialContext.lookup(Unknown Source)
  | 13:42:40,959 ERROR [STDERR] 	at org.jboss.ejb3.stateful.StatefulHandleImpl.getEJBObject(StatefulHandleImpl.java:173)
  | 13:42:40,959 ERROR [STDERR] 	at com.xxx.ejb3.ServiceLocator.getBean(ServiceLocator.java:45)
  | 13:42:40,969 ERROR [STDERR] 	at com.xxx.ejb3.PresentationBean.process(PresentationBean.java:56)
  | 13:42:40,969 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 13:42:40,969 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  | 13:42:40,969 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  | 13:42:40,969 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:181)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
  | 13:42:40,969 ERROR [STDERR] 	at $Proxy229.process(Unknown Source)
  | 13:42:40,969 ERROR [STDERR] 	at com.xxx.servlets.Gateway.doPost(Gateway.java:139)
  | 13:42:40,969 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  | 13:42:40,969 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
  | 13:42:40,969 ERROR [STDERR] 	at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
  | 13:42:40,969 ERROR [STDERR] 	at java.lang.Thread.run(Unknown Source)
  | 13:42:40,969 ERROR [STDERR] java.rmi.RemoteException: Error during getEJBObject; nested exception is: 
  | 	java.lang.NullPointerException
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.stateful.StatefulHandleImpl.getEJBObject(StatefulHandleImpl.java:180)
  | 13:42:40,969 ERROR [STDERR] 	at com.xxx.ejb3.ServiceLocator.getBean(ServiceLocator.java:45)
  | 13:42:40,969 ERROR [STDERR] 	at com.xxx.ejb3.PresentationBean.process(PresentationBean.java:56)
  | 13:42:40,969 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 13:42:40,969 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  | 13:42:40,969 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  | 13:42:40,969 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Unknown Source)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,969 ERROR [STDERR] 	at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:181)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
  | 13:42:40,989 ERROR [STDERR] 	at $Proxy229.process(Unknown Source)
  | 13:42:40,989 ERROR [STDERR] 	at com.xxx.servlets.Gateway.doPost(Gateway.java:139)
  | 13:42:40,989 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  | 13:42:40,989 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
  | 13:42:40,989 ERROR [STDERR] 	at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
  | 13:42:40,989 ERROR [STDERR] 	at java.lang.Thread.run(Unknown Source)
  | 13:42:40,989 ERROR [STDERR] Caused by: java.lang.NullPointerException
  | 13:42:40,989 ERROR [STDERR] 	at javax.naming.InitialContext.getURLScheme(Unknown Source)
  | 13:42:40,989 ERROR [STDERR] 	at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
  | 13:42:40,989 ERROR [STDERR] 	at javax.naming.InitialContext.lookup(Unknown Source)
  | 13:42:40,989 ERROR [STDERR] 	at org.jboss.ejb3.stateful.StatefulHandleImpl.getEJBObject(StatefulHandleImpl.java:173)
  | 13:42:40,989 ERROR [STDERR] 	... 51 more
  | 

I have a ServiceLocator which get the Handle of NamePoolBean (stateful bean) and try to restore the NamePoolBean from the Handle.

My programs are: 

  | @Stateful
  | @Remote(NamePool.class)
  | @RemoteHome(NamePoolHome.class)
  | public class NamePoolBean{ 
  | }
  | 
  | public interface NamePool extends EJBObject{
  | 	public Handle getHandle();
  | }
  | 
  | public interface NamePoolHome extends EJBHome{
  | 	public NamePool create() throws CreateException, RemoteException;
  | }
  | 
  | public class ServiceLocator {
  | 	public void getBean(){
  | 		context = new InitialContext();
  | 		namePoolHome = (NamePoolHome) context.lookup("PROJ/NamePoolBean/remoteHome");
  | 		namePool = namePoolHome.create();
  | 		handle = namePool.getHandle();
  | 		EJBObject ejbObject = handle.getEJBObject();
  | }
  | 

Can anybody help? 

Thanks,


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006498#4006498

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006498



More information about the jboss-user mailing list