geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Viet Nguyen" <vhng...@gmail.com>
Subject Re: how to look up MEJB
Date Fri, 12 Oct 2007 20:48:01 GMT
Thanks a lot David,

However is there another problem and I suspect that is it a security issue.
Here is the snippet of code that I get the exception from:

     Properties props = new Properties();
     props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "
org.apache.openejb.client.LocalInitialContextFactory");
     props.setProperty(Context.SECURITY_PRINCIPAL, "system");
     props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
     Context ic = new InitialContext(props);
     ManagementHome mejbHome =
(ManagementHome)ic.lookup("ejb/mgmt/MEJBRemoteHome");
     Management mejb = mejbHome.create();  // <== I get an exception here.

And here is part of the stack trace that I get

java.lang.IllegalStateException: Can't overwrite cause
        at java.lang.Throwable.initCause(Throwable.java:320)
        at org.apache.openejb.core.ivm.EjbHomeProxyHandler._invoke(
EjbHomeProxyHandler.java:229)
        at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(
BaseEjbProxyHandler.java:245)
        at org.apache.openejb.util.proxy.Jdk13InvocationHandler.invoke(
Jdk13InvocationHandler.java:49)
        at $Proxy14.create(Unknown Source)
        at org.apache.geronimo.monitor.MasterRemoteControl.<init>(
MasterRemoteControl.java:112)

Even though I get an IllegalStateException, when I looked inside OpenEJB's
code for EjbHomeProxyHandler.java at line 229, I actually found out that
openejb is throwing an AccessException. This is why I think I am not
authenticating correctly in order to get full control over the MEJB.

Any help will be appreciated.

Thanks,
Viet

On 10/12/07, David Jencks <david_jencks@yahoo.com> wrote:
>
> the java:comp/env only works when called from javaee components, not
> gbeans.
>
> You could use a gbean reference to the EjbContainer (??) gbean that
> is deployed when the ejb is deployed and then figure out what to call
> to  get the MEJB itself.
>
> Or, if this gbean is called from javaee components you could look up
> the MEJB during such a call, and make sure you have an ejb-ref to it
> in the javaee component.
>
> thanks
> david jencks
>
> On Oct 12, 2007, at 10:10 AM, Viet Nguyen wrote:
>
> > Hi All,
> >
> > I am trying to access the new MEJB from a gbean. I am using the
> > following
> >
> > Context ic = new InitialContext();
> > Object mejbObj = (Object)ic.lookup("java:comp/env/ejb/mgmt/
> > MEJB");    // I get a NotContextException here
> >
> > I have tried to pass a Properties object (with the
> > javax.naming.security.principal and
> > javax.naming.security.credentials) to the InitialContext()
> > constructor, but I get the same exception.
> >
> > I think this is the correct JNDI name for MEJB. Is this problem due
> > to the new security checks? If so, how can I configure my gbean
> > (which is actually bundled inside an EAR) to be able to access the
> > MEJB?
> >
> > Thanks,
> > Viet
>
>

Mime
View raw message