Hi, all,
I'm found a problem with MailGBean on Harmony due to of JNDI
configuration, and I'm asking for help to understand how to deal with
that problem. The problem would occur on any JDK lacking Sun
implementation of JNDI RMI Registry provider
(com.sun.jndi.rmi.registry.RegistryContext). The problem occurs at
startup and looks as follows:
java.lang.IllegalArgumentException: Cannot bind to RMI Registry object
that is neither Remote nor Reference nor Referenceable
at
org.apache.harmony.jndi.provider.rmi.registry.RegistryContext.getStateTo
Bind(RegistryContext.java:618)
at
org.apache.harmony.jndi.provider.rmi.registry.RegistryContext.bind(Regis
tryContext.java:266)
at
org.apache.harmony.jndi.provider.rmi.registry.RegistryContext.bind(Regis
tryContext.java:280)
at javax.naming.InitialContext.bind(InitialContext.java:411)
at
org.apache.geronimo.mail.MailGBean.doStart(MailGBean.java:385)
The investigation shows the following difference of MailGBean code
operation on Sun and Harmony:
On Sun, the InitialContext.getEnvironment() is empty, and
InitialContext.lookup("") returns
org.apache.geronimo.gjndi.GlobalContextGBean, and
InitialContext.getNameParser("") returns
org.apache.xbean.naming.context.ContextUtil$SimpleNameParser.
On Harmony, this works much differently -
InitialContext.getEnvironment() contains the JNDI properties specified
in config.xml, and InitialContext.lookup("") returns
org.apache.harmony.jndi.provider.rmi.registry.RegistryContext, and
InitialContext.getNameParser("") returns
org.apache.harmony.jndi.provider.rmi.registry.AtomicNameParser.
This causes the error above.
I had to specify the respective JNDI properties in config.xml for
JMXConnector to start normally, as follows:
<module name="org.apache.geronimo.configs/rmi-naming/2.0.2/car">
<gbean name="NamingProperties">
<attribute
name="namingFactoryInitial">org.apache.harmony.jndi.provider.rmi.registr
y.RegistryContextFactory</attribute>
<attribute
name="namingFactoryUrlPkgs">org.apache.harmony.jndi.provider</attribute>
<attribute name="namingProviderUrl">rmi://${ServerHostname}:${NamingPort
+ PortOffset}</attribute>
</gbean>
Probably this is wrong to configure JNDI this way, as it overrides
Geronimo internal naming mechanisms?
Maybe org.apache.geronimo.gjndi.GlobalContextGBean needs to be tweaked
to find the proper JNDI RMI Registry provider by other means than
standard JNDI properties?
I'd be happy to hear any ideas, considerations or suggestions on this
issue.
Thank you very much!
Vasily Zakharov
Intel ESSD
---