geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Problem accessing JNDI resources from inside custom resource adapter
Date Fri, 13 Mar 2009 16:51:04 GMT

On Mar 13, 2009, at 6:28 AM, Olaf Bergner wrote:

>
> I'm trying to deploy a Spring context as a custom resource adapter  
> using
> Spring's
> http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/jca/context/SpringContextResourceAdapter.html
> SpringContextResourceAdapter . From inside the deployed Spring  
> context, I'm
> trying to access a JMS queue using
>
> <jee:jndi-lookup id="myQueue" jndi-name="jms/MyQueue"/>,
>
> i.e. using Spring's JNDI support.
>
> This however fails with a message to the effect (I'm currently at  
> work and
> may provide more detailed information later) that I'm trying to  
> access the
> JNDI context from a thread that hasn't yet initialized it. This  
> message is
> wrapped in an NPE thrown when
>
> RootContext.getContext()
>
> returns null.
>
> Could anyone in the know tell me what I'm doing wrong?


I'd guess that for reasons of its own spring is looking up something  
in the java:comp jndi context.  This is not defined nor guaranteed to  
be available in a resource adapter.  If you call the resource adapter  
from a thread that has gone through a javaEE component, in geronimo  
you will get the java:comp context of that component.

If you really need to package your code as a resource adapter you  
probably need to use the global jndi context.  See http://cwiki.apache.org/GMOxDOC21/jndi.html

  (I can't find this in the 2.2 docs)  I don't know how you would get  
spring to look here.

However, I can't imagine a scenario in which packaging your code as a  
resource adapter makes any sense.  In all the scenarios I can imagine  
you would get much better results using SSB ejbs.  Generally you only  
want to write a resource adapter if your code is actually connecting  
to a remote resource manager.  Since you are trying to look up a jms  
queue from another resource adapter it seems that at least much of  
your code is not doing this.

thanks
david jencks

>
>
> Thx,
> Olaf
> -- 
> View this message in context: http://www.nabble.com/Problem-accessing-JNDI-resources-from-inside-custom-resource-adapter-tp22496418s134p22496418.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Mime
View raw message