geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Łukasz Budnik" <lukasz.bud...@gmail.com>
Subject Re: jndi names changed in 2.1?
Date Tue, 23 Sep 2008 07:25:36 GMT
Hi David,

I followed your advice and read the actual JNDI name from
geronimo.log. It turned out to be simply RemoteServiceImpl + Remote.

But if we're still in JNDI names.

One of My SLSB uses JMS resources like this:

@Resource(name = "ODEBPELProcessInvocationOrderConnectionFactory")
private ConnectionFactory connectionFactory;
@Resource(name = "ODEBPELProcessInvocationOrderQueue")
private Queue queue;

All works fine, I can send messages to MDB.
The problem is that I want it to be more configurable, connection
factory and queue's names defined in XML or in database.

I injected context:

@Resource
private SessionContext ctx;

and tried to lookup my queue. From geronimo.log I can see:

09:11:42,468 INFO  [startup]
Jndi(name=NuntiusEJB.jar/ODEBPELProcessInvocationQueue) -->
Ejb(deployment-id=NuntiusEJB.jar/ODEBPELProcessInvocationQueue)

(only queue bound, no connection factory)

I commented out @Resource ConnectionFactory  and Queue wrote and in SLSB:

Object queue = ctx.lookup("NuntiusEJB.jar/ODEBPELProcessInvocationQueue");

result:

javax.naming.NotContextException - NuntiusEJB.jar/ODEBPELProcessInvocationQueue

Then I wrote a simple code to traverse all context recursively:

Context c = new InitialContext();
ctx.listBindings("");

it's magic...

java:comp/env/java:/ger:/java:comp/jca:/org.xh.nuntius/EnterpriseContainer/JCAManagedConnectionFactory/NuntiusDB2/ODEBPELProcessInvocationOrderConnectionFactory

class: org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper

java:comp/env/java:/ger:/java:comp/jca:/org.xh.nuntius/EnterpriseContainer/JCAManagedConnectionFactory/JCAAdminObject/ODEBPELProcessInvocationOrderQueue

class: org.apache.geronimo.connector.AdminObjectWrapper

Only wrapper classes. No actual connection factory or queue.

My question: how to fetch JMS resources dynamically from InitialContext?

best regards
Łukasz

2008/9/23 David Jencks <david_jencks@yahoo.com>:
>
> On Sep 22, 2008, at 2:34 PM, Łukasz Budnik wrote:
>
>> Hi all,
>>
>> I've been using Geronimo 2.0.2 some time ago and I was able to access
>> remote SLSB this way:
>>
>>
>> DataWeaver2EnterpriseModuleProxy.jar/ModuleProxyImpl/org.xh.dataweaver.interfaces.ejb.ModuleProxy
>>
>> now I'm using Geronimo 2.1 and I'm trying to access remote bean in the
>> same manner:
>>
>> Properties env = new Properties();
>> env.put(Context.INITIAL_CONTEXT_FACTORY,
>>                "org.apache.openejb.client.RemoteInitialContextFactory");
>> env.put(Context.PROVIDER_URL, "ejbd://localhost:4201");
>> Context ctx = new InitialContext(env);
>>
>> ctx.lookup("NuntiusEJB.jar/RemoteServiceImpl/"
>>                + RemoteService.class.getCanonicalName());
>>
>> the result is:
>>
>> javax.naming.NameNotFoundException:
>>
>> /NuntiusEJB.jar/RemoteServiceImpl/org.xh.nuntius.enterprise.frontend.RemoteService
>> does not exist in the system.  Check that the app was successfully
>> deployed.
>>        at
>> org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:239)
>>        at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>
>> Does anybody knows how it's done in G2.1? Or am i missing something very
>> stupid?
>
> It's quite flexible and I don't remember the details.... but you can find
> out what your ejbs were actually bound to by looking in the
> var/log/geronimo.log where your app starts up.
>
> thanks
> david jencks
>
>>
>>
>> best regards
>> Łukasz
>
>
Mime
View raw message