geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shenghao Fang <>
Subject [Disscussion] Reference binded in JNDI is not dereferenced properly when lookup
Date Thu, 14 Apr 2011 03:35:32 GMT

When I did the enablement for the monitoring portlet, I lookup the
datasource from JNDI and got an object of type javax.naming.Reference
instead of javax.sql.DataSource.

I debugged into JNDI related modules and found the following clues:

1. If the object to be bound is of type javax.naming.Referenceable,
then the object of type javax.naming.Reference retrieved by
Referenceable.getReference() will be bound. And the object should be
dereferenced automatically when lookup.

2. When lookup from JNDI, javax.naming.spi.NamingManager tries to use
the ObjectFactoryBuilder set to dereference. In current
implementation, we set org.apache.aries.jndi.OSGiObjectFactoryBuilder
to ObjectFactoryBuilder.

3. Since the datasource is not packaged as an OSGi bundle,
OSGiObjectFactoryBuilder returns the Reference directly.

I have no idea on how to fix this, any idea? Thanks.


View raw message