geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shenghao Fang <michael1224.f...@gmail.com>
Subject Re: [Disscussion] Reference binded in JNDI is not dereferenced properly when lookup
Date Thu, 14 Apr 2011 05:15:17 GMT
Hi Ivan,

Thanks for your hits.

2011/4/14 Ivan <xhhsld@gmail.com>:
> From the codes in DataSourceBuilder, the jndi reference is with prefix
> aries:service, so there should be something like an ObjectFactory would take
> care of it. I could see a service org\apache\aries\jndi\url\Activator.class
> support this schema is registered in the activator, I simply compared that
> Java file between 0.2 and 0.3 seems that some logic is changed, think this
> should be a place to begin the debugging.
> Hope it helps.
>
> 2011/4/14 Shenghao Fang <michael1224.fang@gmail.com>
>>
>> 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
>
>
>
> --
> Ivan
>



-- 
Michael

Mime
View raw message