[Carbon-dev] Carbon Core JNDI Lookup Issue

Senaka Fernando senaka at wso2.com
Sat Jul 9 05:00:40 EDT 2011


Hi Anjana,

On Sat, Jul 9, 2011 at 1:55 PM, Anjana Fernando <anjana at wso2.com> wrote:

> Hi Senaka,
>
> On Sat, Jul 9, 2011 at 7:22 AM, Senaka Fernando <senaka at wso2.com> wrote:
>
>> Hi Anjana,
>>
>> AmilaJ and I looked into this issue. The JNDI look-up is working fine for
>> DB Drivers, and LDAP. Can you also paste the code that you tried and failed?
>> Since both AmilaJ and I felt that you might be using new InitialContext()
>> instead of new InitialContext(hashMap) and expect the former to behave like
>> the latter. Was that the case?
>>
>
> Yeah, others worked fine, that's why anyone else didn't find it earlier I
> guess. You've to use it with the TransactionMediator in the ESB, or use DSS
> distributed transactions (which only works in a new server restart), to spot
> the issue. The TransactionMediator does use "new InitialContext()", and in
> DSS we directly use "InitialContext.doLookup". Isn't the default constructor
> for InitialContext anyway suppose to work? ..
>

Nope it is not supposed to work like that. See [1 - 2].


> I guess it gets those properties from the environment. And as I said in the
> initial mail, the values do get passed into the place in
> CarbonContextHolder's code when it internally create an InitialContext
> object, but later when they retrieve it, it's not there. If you follow the
> same steps, you can see it. That's why I did a patch to save those Hashtable
> values and use them later.
>

Assume what you say is correct for some reason, though the spec does not say
anything. In that case, your fix is still a hack, and is not generic, and
will also break some other code. This is because you are actually using the
wrong environment. If the InitialContext ever had an environment when it was
created, it would get replaced by the one which was used when the factory
was created. So, if we are to fix this we need to find a proper solution.

[1]
http://download.oracle.com/javase/6/docs/api/javax/naming/InitialContext.html#InitialContext%28%29
[2]
http://download.oracle.com/javase/6/docs/api/javax/naming/Context.html#RESOURCEFILES

Thanks,
Senaka.

>
> Cheers,
> Anjana.
>
>
>>
>> Thanks,
>> Senaka.
>>
>>
>> On Fri, Jul 8, 2011 at 9:22 PM, Anjana Fernando <anjana at wso2.com> wrote:
>>
>>> Reminder, this issue should be fixed for the Stratos release. I've
>>> created a JIRA here [1].
>>>
>>> [1] https://wso2.org/jira/browse/CARBON-10975
>>>
>>> Cheers,
>>> Anjana.
>>>
>>>
>>> On Sun, Jul 3, 2011 at 4:33 PM, Anjana Fernando <anjana at wso2.com> wrote:
>>>
>>>> Hi Amila,
>>>>
>>>> On Sat, Jul 2, 2011 at 11:20 PM, Amila Jayasekara <amilaj at wso2.com>wrote:
>>>>
>>>>>
>>>>> Any idea, which call causes CarbonInitialJNDIContextFactory to pass an
>>>>> empty hash table ?
>>>>>
>>>>
>>>> Passed the empty hashtable as in, a proper one is passed into the place
>>>> at line 755 (in the code that's in svn). There it says
>>>> "factory.getInitialContext(h)", and creates an InitialContext object, that
>>>> object in the construction somehow empties out the hashtable as given as "h"
>>>> here. Anyhow, the result is at line 852, the expression
>>>> "initialContext.getEnvironment()" returns an empty Hashtable object.
>>>>
>>>> Cheers,
>>>> Anjana.
>>>>
>>>>
>>>>>
>>>>> Thanks
>>>>> AmilaJ
>>>>>
>>>>> >
>>>>> > Another thing to note is, the ESB has the geronimo-jta lib. This
>>>>> causes
>>>>> > Atomikos to not to work properly, since the JDK also has these libs,
>>>>> and you
>>>>> > will ultimately get an ClassCastException. So I simply deleted this
>>>>> jar and
>>>>> > it worked without any issues.
>>>>> >
>>>>> > Cheers,
>>>>> > Anjana.
>>>>> >
>>>>> > --
>>>>> > Anjana Fernando
>>>>> > Senior Software Engineer
>>>>> > WSO2 Inc. | http://wso2.com
>>>>> > lean . enterprise . middleware
>>>>> >
>>>>> > _______________________________________________
>>>>> > Carbon-dev mailing list
>>>>> > Carbon-dev at wso2.org
>>>>> > http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>> >
>>>>> >
>>>>> _______________________________________________
>>>>> Carbon-dev mailing list
>>>>> Carbon-dev at wso2.org
>>>>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Anjana Fernando*
>>>> Senior Software Engineer
>>>> WSO2 Inc. | http://wso2.com
>>>> lean . enterprise . middleware
>>>>
>>>
>>>
>>>
>>> --
>>> *Anjana Fernando*
>>> Senior Software Engineer
>>> WSO2 Inc. | http://wso2.com
>>> lean . enterprise . middleware
>>>
>>
>>
>>
>> --
>> *Senaka Fernando*
>> Product Manager - WSO2 Governance Registry;
>> Associate Technical Lead; WSO2 Inc.; http://wso2.com*
>> Member; Apache Software Foundation; http://apache.org
>>
>> E-mail: senaka AT wso2.com
>> **P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
>> Linked-In: http://linkedin.com/in/senakafernando
>>
>> *Lean . Enterprise . Middleware
>>
>>
>
>
> --
> *Anjana Fernando*
> Senior Software Engineer
> WSO2 Inc. | http://wso2.com
> lean . enterprise . middleware
>



-- 
*Senaka Fernando*
Product Manager - WSO2 Governance Registry;
Associate Technical Lead; WSO2 Inc.; http://wso2.com*
Member; Apache Software Foundation; http://apache.org

E-mail: senaka AT wso2.com
**P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
Linked-In: http://linkedin.com/in/senakafernando

*Lean . Enterprise . Middleware
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.wso2.org/pipermail/carbon-dev/attachments/20110709/8991af4b/attachment.html>


More information about the Carbon-dev mailing list