Hi,

I'm trying to fix [1]. The error occurs at line 104 in [2].

In Tomcat "java:/" is being looked up in a SelectorContext[4] and in
Application Server it is looked up in a NamingContext[5].
This is because, in AS an InitialContextFactoryBuilder is created[3] before
this point is reached therefore according to the logic if there is already
an InitialContextFactory, the default initial context should be used so
ultimately the name is being looked up in a NamingContext.

But in Tomcat an InitialContextFactory is not present therefore a
SelectorContext is obtained using the name(i.e. java:/)

I've got two problems.

1. What is the purpose of having two Context implementations as
SelectorContext and NamingContext ? In Tomcat documentation there wasn't
any explanation on this.

2. In javax.naming.InitialContext why is it being checked for an
InitialContextFactory and if it exists the default initial context is
returned, in the method getURLOrDefaultInitCtx ?
According to the method description if the name is a URL string then a URL
context should be returned. But here, if an initial context factory builder
is present the default initial context is returned and it is possible that
the name is not present in default initial context.[6]

Any help on this would be highly appreciated.

[1] https://wso2.org/jira/browse/WSAS-2073
[2]
https://github.com/apache/tomcat/blob/TOMCAT_7_0_42/java/org/apache/catalina/mbeans/GlobalResourcesLifecycleListener.java
[3]
https://github.com/wso2/carbon4-kernel/blob/master/core/org.wso2.carbon.utils/src/main/java/org/wso2/carbon/context/internal/CarbonContextDataHolder.java
[4]
https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/naming/SelectorContext.html
[5]
https://tomcat.apache.org/tomcat-7.0-doc/api/org/apache/naming/NamingContext.html
[6]
http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/javax/naming/InitialContext.java?av=f

​Thank you.​

-- 

*Manuri Amaya Perera*

*Software Engineer*

*WSO2 Inc.*

*Blog: http://manuriamayaperera.blogspot.com
<http://manuriamayaperera.blogspot.com>*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to