Hi,

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.


-- 
Michael

Reply via email to