Hi all,

Based on [1], I modified the web app code [2] to use the catalina JNDI
context as follows

Context initCtx = new InitialContext();

SelectorContext selectorContext = new SelectorContext((Hashtable<String,
Object>) initCtx.getEnvironment(), false);
Context envContext = (Context) selectorContext.lookup("java:comp/env");

and this works. But why the normal way to lookup throws an exception in AS
after the change to CarbonJavaURLContextFactory [2], but the same app works
fine in tomcat?

[1] - http://mail.wso2.org/mailarchive/dev/2012-May/005396.html
[2] -
https://github.com/wso2/product-as/blob/master/modules/integration/tests-common/common-artifacts/tomcat-jndi-resource-lookup/src/main/java/org/wso2/appserver/foo/jndi/TomcatDataSourceLookupServlet.java#L46

Regards,
Nira

On Wed, Jul 15, 2015 at 10:04 AM, Niranjan Karunanandham <niran...@wso2.com>
wrote:

> Hi all,
>
> In current product-as SNAPSHOT (available at [1]), when a lookup for JNDI
> (defined in the webapp itself [2]) is performed, it throws an exception
> [3]. The sample application works in tomcat.
>
> This issue occurred after the change mentioned in JIRA [4] was done.
> Previously when the CarbonJavaURLFactory (extension of
> javaURLContextFactory) returns SelectorContext for a lookup from webapps,
> it returns a "Read-Only" context, this was changed to "Read-Write" by
> changing the boolean value in [1] to true.
>
>
> [1] - https://github.com/wso2/product-as
> [2] -
> https://github.com/wso2/product-as/blob/master/modules/integration/tests-common/common-artifacts/tomcat-jndi-resource-lookup/src/main/java/org/wso2/appserver/foo/jndi/TomcatDataSourceLookupServlet.java#L46
> [3] - https://wso2.org/jira/browse/WSAS-2008
> [4] - https://wso2.org/jira/browse/CARBON-15274
> [5] -
> https://github.com/wso2/carbon4-kernel/blob/master/core/org.wso2.carbon.tomcat/src/main/java/org/wso2/carbon/tomcat/jndi/CarbonJavaURLContextFactory.java#L41
>
>
> Regards,
> Nira
>
> --
>
> *Niranjan Karunanandham*
> Senior Software Engineer - WSO2 Inc.
> WSO2 Inc.: http://www.wso2.com
>



-- 

*Niranjan Karunanandham*
Senior Software Engineer - WSO2 Inc.
WSO2 Inc.: http://www.wso2.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to