On Sat, May 26, 2012 at 3:05 PM, Dinusha Senanayaka <[email protected]>wrote:

> Hi Kishanthan,
>
> The way you suggested also didn't work for me. I guess, in your sample
> wep-app, JNDI lookup has done for some data-source created within Tomcat
> itself.
>

Can you share the webapp? I'll have a look into this.

Thanks,
Kishanthan.

>
> Regards,
> Dinusha.
>
>
> On Sat, May 26, 2012 at 12:50 PM, Supun Malinga <[email protected]> wrote:
>
>> Hi Kishanthan,
>>
>> Any idea why 'normal'  jndi lookup doesn't work?
>> If I'm a user and want to do some jndi lookup insid ea webapp I would
>> follow the standard way. If that's not going to work I think we better at
>> least document this.
>>
>> thanks,
>>
>> On Sat, May 26, 2012 at 11:31 AM, Kishanthan Thangarajah <
>> [email protected]> wrote:
>>
>>> Hi,
>>> This was one the issue I encountered when trying to write some webapps
>>> with webapp specific contextXml configuration where I store some JNDI
>>> resources in it. Normal lookup is as follow, which gives the exception when
>>> trying within a webapp,
>>>
>>>     Context initCtx = new InitialContext();
>>>     Context envCtx = (Context) initCtx.lookup("java:comp/env");
>>>
>>> But after some debugging at tomcat code level, I found a way to overcome
>>> this. We have to use the catalina jndi context implementation. Let me give
>>> some insight.
>>>
>>>     Context initCtx = new InitialContext();
>>>     SelectorContext selectorContext = new
>>> SelectorContext((Hashtable<String, Object>) initCtx.getEnvironment(),
>>> false);
>>>     Context envCtx = (Context) selectorContext.lookup("java:comp/env");
>>>
>>> Here the SelectorContext is the Catalina JNDI Context implementation.
>>> First using the IntialContext environment we have to build the Catalina
>>> selector context, and then we can lookup from that. Can you please try this
>>> and let me know if it fails? You can take a look at the webapp samples here
>>> [1].
>>>
>>> Thanks,
>>> Kishanthan.
>>> [1]
>>> https://svn.wso2.org/repos/wso2/carbon/platform/trunk/products/as/modules/samples/product/TomcatWebApps/
>>>
>>> On Fri, May 25, 2012 at 5:45 PM, Dinusha Senanayaka <[email protected]>wrote:
>>>
>>>>  Hi All,
>>>>
>>>> I have registered a object with JNDI and try to access it within a
>>>> web-app. But JNDI lookup get fails saying
>>>> "javax.naming.NameNotFoundException: Name [java:comp/TransactionManager] is
>>>> not bound in this Context. Unable to find [java:comp]".  Even I tried to
>>>> lookup a Carbon JNDI data-source, it also fails by giving similar type
>>>> exception.
>>>>
>>>> But same JNDI lookups work inside a Axis2 service(AAR). Any idea why
>>>> this can be happened ?
>>>>
>>>> Regards,
>>>> Dinusha.
>>>>
>>>>
>>>> _______________________________________________
>>>> Dev mailing list
>>>> [email protected]
>>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>>
>>>>
>>>
>>>
>>> --
>>> *Kishanthan Thangarajah*
>>> Software Engineer,
>>> Development Technologies Team,
>>> WSO2, Inc.
>>> lean.enterprise.middleware
>>>
>>> Mobile - +94773426635
>>> Blog - *http://kishanthan.wordpress.com*
>>> Twitter - *http://twitter.com/kishanthan*
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> [email protected]
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Supun Malinga,
>>
>> Software Engineer,
>> WSO2 Inc.
>> http://wso2.com
>> http://wso2.org
>> email - [email protected] <[email protected]>
>> mobile - 071 56 91 321
>>
>>
>


-- 
*Kishanthan Thangarajah*
Software Engineer,
Development Technologies Team,
WSO2, Inc.
lean.enterprise.middleware

Mobile - +94773426635
Blog - *http://kishanthan.wordpress.com*
Twitter - *http://twitter.com/kishanthan*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to