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 Mon, 15 Oct 2007 15:21:57 GMT
It is weird, I redeployed the EAR and now I am getting this stack trace from
trying to use OpenEJB jndi lookup:

javax.naming.NamingException: Cannot instantiate an IntraVM InitialContext.
Exception: javax.naming.AuthenticationException User could not be
authenticated: system [Root exception is
javax.naming.AuthenticationException: User could not be authenticated:
system [Root exception is javax.security.auth.login.LoginException: No
LoginModules configured for OpenEJB]]
        at
org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContext(
LocalInitialContextFactory.java:113)
        at
org.apache.openejb.client.LocalInitialContextFactory.getInitialContext(
LocalInitialContextFactory.java:49)
        at javax.naming.spi.NamingManager.getInitialContext(
NamingManager.java:667)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java
:247)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.InitialContext.<init>(InitialContext.java:197)
        at org.apache.geronimo.monitor.MasterRemoteControl.<init>(
MasterRemoteControl.java:105)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(
NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(
DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.createInstance(
GBeanInstance.java:946)
        at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(
GBeanInstanceState.java:268)
        at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(
GBeanInstanceState.java:102)
        at
org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(
GBeanInstanceState.java:124)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(
GBeanInstance.java:553)
        at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(
BasicKernel.java:379)
        at
org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans
(ConfigurationUtil.java:448)
        at
org.apache.geronimo.kernel.config.KernelConfigurationManager.start(
KernelConfigurationManager.java:187)
        at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration
(SimpleConfigurationManager.java:530)
        at
org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration
(SimpleConfigurationManager.java:511)
        at
org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke
(<generated>)
        at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
        at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(
FastMethodInvoker.java:38)
        at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(
GBeanOperation.java:124)
        at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(
GBeanInstance.java:830)
        at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(
RawInvoker.java:57)
        at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(
RawOperationInvoker.java:35)
        at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept
(ProxyMethodInterceptor.java:96)
        at
org.apache.geronimo.kernel.config.EditableConfigurationManager$$EnhancerByCGLIB$$4af7e83e.startConfiguration
(<generated>)
        at
org.apache.geronimo.deployment.plugin.local.RedeployCommand.redeploySameConfiguration
(RedeployCommand.java:229)
        at org.apache.geronimo.deployment.plugin.local.RedeployCommand.run(
RedeployCommand.java:101)
        at java.lang.Thread.run(Thread.java:595)
Caused by: javax.naming.AuthenticationException: User could not be
authenticated: system [Root exception is
javax.security.auth.login.LoginException: No LoginModules configured for
OpenEJB]
        at
org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialContext(
InitContextFactory.java:48)
        at
org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContext(
LocalInitialContextFactory.java:111)
        ... 32 more
Caused by: javax.security.auth.login.LoginException: No LoginModules
configured for OpenEJB
        at javax.security.auth.login.LoginContext.init(LoginContext.java
:256)
        at javax.security.auth.login.LoginContext.<init>(LoginContext.java
:367)
        at javax.security.auth.login.LoginContext.<init>(LoginContext.java
:444)
        at org.apache.geronimo.security.ContextManager.login(
ContextManager.java:74)
        at org.apache.geronimo.openejb.GeronimoSecurityService.login(
GeronimoSecurityService.java:52)
        at org.apache.geronimo.openejb.GeronimoSecurityService.login(
GeronimoSecurityService.java:48)
        at
org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialContext(
InitContextFactory.java:45)
        ... 33 more

So it looks like I am supposed to have configured a LoginModule for OpenEJB?


Here is my ***geronimo-application.xml***
=============================================================================
<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2">

    <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
        <moduleId>
            <groupId>org.apache.geronimo.samples</groupId>
            <artifactId>mrc-ear</artifactId>
            <version>2.0</version>
            <type>ear</type>
        </moduleId>

        <dependencies>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
                <version>1.0</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-ejb_3.0_spec</artifactId>
                <version>1.0</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.configs</groupId>
                <artifactId>j2ee-server</artifactId>
                <version>2.1-SNAPSHOT</version>
                <type>car</type>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.modules</groupId>
                <artifactId>geronimo-j2ee</artifactId>
                <version>2.1-SNAPSHOT</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.modules</groupId>
                <artifactId>geronimo-system</artifactId>
                <version>2.1-SNAPSHOT</version>
                <type>jar</type>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.configs</groupId>
                <artifactId>mejb</artifactId>
                <version>2.1-SNAPSHOT</version>
                <type>car</type>
            </dependency>
        </dependencies>
    </environment>

    <module>
        <connector>tranql-connector-ra-1.3.rar</connector>
        <alt-dd>MonitorDBPool.xml</alt-dd>
    </module>

    <gbean name="MasterRemoteControl" class="
org.apache.geronimo.monitor.MasterRemoteControl" />

    <!-- standard realm GBean configuration -->
    <gbean name="MEJBRealm" class="
org.apache.geronimo.security.realm.GenericSecurityRealm">
      <attribute name="realmName">MEJBRealm</attribute>
      <reference name="ServerInfo">
        <name>ServerInfo</name>
      </reference>
      <!--reference name="LoginService">
         <name>JaasLoginService</name>
      </reference-->
      <xml-reference name="LoginModuleConfiguration">
        <login-config xmlns="http://geronimo.apache.org/xml/ns/loginconfig">
          <login-module control-flag="REQUIRED">
            <login-domain-name>MEJBRealm</login-domain-name>
            <login-module-class>
org.apache.geronimo.security.realm.providers.PropertiesFileLoginModule
</login-module-class>
            <option
name="usersURI">var/security/some_users.properties</option>
            <option
name="groupsURI">var/security/some_groups.properties</option>
          </login-module>
        </login-config>
      </xml-reference>
    </gbean>
</application>
======================================================================================

I've tried deploying the app, with and without the security realm defined,
but I get the same stack trace. Does anybody knows what's going on?

Thanks
Viet

On 10/12/07, Viet Nguyen <vhnguy2@gmail.com> wrote:
>
> 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