[jboss-user] Re: Using @Resource causes NPE at org.jboss.ejb3.JndiUtil.lookup

samk at twinix.com samk at twinix.com
Tue Apr 15 09:51:02 EDT 2008


See Thread at: http://www.techienuggets.com/Detail?tx=30772 Posted on behalf of a User

I have had a similar problem with MDBs. 
My problem was that the resource is was referring to via the mapped name was not infact a QueueConnectionFactory but infact something completely different... the provider adapter.
By correcting the mapped name, the problem was fixed.
The exception / stack trace provided no guidance to solving this problem... only through trial and error did I realise the cause.

In Response To: 

Hello,

In a stateless EJB im using:


  | @Resource(name = "mail/localMail", mappedName = "Mail", shareable = true, type = Session.class)
  | private Session m_mailSession;
  | 

Trying to connect the Bean from a Client I got an NullPointerException.

Im using JBoss-4.2.2.GA default installation without any changes
Windows XP

Any hints?

Regards,

Georg


  | Exception in thread "main" java.lang.NullPointerException
  | 	at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:49)
  | 	at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:87)
  | 	at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:112)
  | 	at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:107)
  | 	at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:65)
  | 	at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:111)
  | 	at org.jboss.ejb3.InfinitePool.get(InfinitePool.java:49)
  | 	at org.jboss.ejb3.ThreadlocalPool.create(ThreadlocalPool.java:50)
  | 	at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:90)
  | 	at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:54)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
  | 	at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:304)
  | 	at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
  | 	at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
  | 	at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:769)
  | 	at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:573)
  | 	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:373)
  | 	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:166)
  | 	at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:163)
  | 	at org.jboss.remoting.Client.invoke(Client.java:1634)
  | 	at org.jboss.remoting.Client.invoke(Client.java:548)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  | 	at $Proxy0.registration(Unknown Source)
  | 	at gse.client.Client.main(Client.java:13)
  | 	at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:67)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:53)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74)
  | 	at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
  | 	at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:107)
  | 	at $Proxy0.registration(Unknown Source)
  | 	at gse.client.Client.main(Client.java:13)
  | 
  |  





More information about the jboss-user mailing list