You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Łukasz Budnik <lu...@gmail.com> on 2008/09/22 23:34:44 UTC
jndi names changed in 2.1?
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?
best regards
Łukasz
Re: jndi names changed in 2.1?
Posted by David Jencks <da...@yahoo.com>.
On Sep 23, 2008, at 12:25 AM, Łukasz Budnik wrote:
> 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.
I have no idea how these got here.... maybe some openejb magic.
>
>
> My question: how to fetch JMS resources dynamically from
> InitialContext?
The java:comp/env context is only supposed to have the stuff you've
explicitly put there before deployment via annotations or spec dd xml,
so I doubt that is what you want. Instead I think you want to use the
in-vm global jndi context explained here:
http://cwiki.apache.org/GMOxDOC21/jndi.html
thanks
david jencks
>
>
> best regards
> Łukasz
>
> 2008/9/23 David Jencks <da...@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
>>
>>
Re: jndi names changed in 2.1?
Posted by Łukasz Budnik <lu...@gmail.com>.
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 <da...@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
>
>
Re: jndi names changed in 2.1?
Posted by David Jencks <da...@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