You can get the OpenEJB ContainerSystem JNDI context with this code:
ContainerSystem containerSystem = SystemInstance.get().getComponent
(ContainerSystem.class);
if (containerSystem != null) {
Context context = containerSystem.getJNDIContext();
...
}
-dain
On Oct 9, 2007, at 6:50 AM, Joe Bohn wrote:
Manu George wrote:
Hi Joe,
Just had a look at the MEJB App.
https://svn.apache.org/repos/asf/geronimo/server/trunk/
applications/geronimo-mejb/src/main/java/org/apache/geronimo/mgmt/
MEJB.java
Won't setting the mappedName in the @Stateless(name="ejb/mgmt/MEJB")
annotation completely bypass the troublesome code in
GeronimoMappedName and solve the problem?
Yes, I think setting the JNDI name would fix the problem. However
I think the problem is actually that the application that is
referencing MEJB doesn't have a JNDI name mapped for the reference
to MEJB and so it defaults to match the ref name "ejb/MEJB". IIUC
it's because the app doesn't have a mapped JNDI name that the
GeronimoMappedName code comes into the picture and forces the
MEJBGBean/MEJB name. I'd like to avoid creating distribution plans
for the apps it possible (this is in the tck and there are a lot of
apps) but I'm nearly at the point where this might be necessary.
Regarding JNDI link to map MEJBGBean/MEJB to mejb/ejb/mgmt/MEJB you
need to bind a javax.naming.LinkRef at MEJBGBean/MEJB with the
linkName as mejb/ejb/mgmt/MEJB.
Thanks ... I'll give that a try.
Regards
Manu
On 10/8/07, Joe Bohn <[EMAIL PROTECTED]> wrote:
Dain Sundstrom wrote:
On Oct 5, 2007, at 12:14 PM, Joe Bohn wrote:
NOTE: This was also posted on the Geronimo dev list.
We've been hitting some errors in the TCK tests that validate mgmt
with MEJB. The main problem was that we were failing the name
lookup:
javax.naming.NameNotFoundException: Name
"java:openejb/Deployment/MEJBGBean/MEJB/
javax.management.j2ee.Management"
not found
I thought this was strange because we don't include the
MEJBGBean any
longer in the geronimo assembly and I could find no reference
to it in
the Geronimo code at all.
It turns out that we map to the "GBEAN" name when there is no
mappedName specified in the Openejb code. In
o.a.openejb.config.GeronimoMappedName at line 65 there is this
piece
of code which Geronimo is apparently very dependent upon
if (null == mappedName && ref.getEjbRefName().equals("ejb/
MEJB")) {
ref.setMappedName("MEJBGBean/MEJB");
}
So I assume the mappedName must always be null and we need to
force
this mapping for Geronimo?
Once I modified the name to match the newly enabled MEJB app's id,
"mejb/ejb/mgmt/MEJB", then I finally started to see failures that
matched what Anita indicated we should see without the correct
authorization.
So what should we do with this openejb change? We were hoping to
release Geronimo 2.0.2 with openejb 3.0-beta-1 which has the
old name
still included. There are probably other ways around this that
would
only require Geronimo (such as making the new name match the
old name
... but that's really ugly) or perhaps TCK configuration
changes. Any
suggestions?
How about you add a JNDI link from MEJBGBean/MEJB to mejb/ejb/
mgmt/MEJB?
Thanks Dain. I'd gladly to give this a try but I have no clue
how to go
about defining a JNDI link to map MEJBGBean/MEJB to mejb/ejb/mgmt/
MEJB.
So far my searches have turned up anything that helps. Can
you give
me some pointers?
Thanks,
Joe