geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olaf Bergner <>
Subject Re: Problem accessing JNDI resources from inside custom resource adapter
Date Fri, 13 Mar 2009 17:10:25 GMT

David, thanks for your comprehensive and helpful reply. My choice of using a
rar as my deployment unit is mainly motivated by my need to start my own
threads. I therefore figured that using the JEE work manager API would be
the most standards compliant way to do so. Yet I suspect that in practice
nothing would keep me from accessing Geronimo's work manager from a SLSB.


djencks wrote:
> 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
>> 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
>   (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:
>> Sent from the Apache Geronimo - Users mailing list archive at  

View this message in context:
Sent from the Apache Geronimo - Users mailing list archive at

View raw message