I have read http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html http://tomcat.apache.org/tomcat-7.0-doc/jndi-resources-howto.html
1)I would like to ask about essence of jndi a) jndi as a whole and b) jndi in tomcat In all known to me cases jndi in tomcat and in jboss is used only as http://docs.oracle.com/javase/1.5.0/docs/api/javax/naming/InitialContext.html#lookup%28java.lang.String%29 2) are there any other common uses ? 3) Can we say JNDI in tomcat is a static Map for each application ? actually a map, that can hold simple values and objects(int, string), object factories on which Map.get doesn't return them, but returns objects created by this factories, object pools - similar to factories and this static Map can be configured with xml in web.xml and in context.xml. 4) Is this a good comparison ? InitialContext.lookup is not more than Map.get, apart from case of factories. 5) Or INDI in tomcat has much more functionality ? 6) Is comparison to spring container with scope singleton and prototype more adequate ? 7) Can we say it is older implementation of spring bean container ? 8)Where is the difference between a) Map and jndi b) spring container and jndi 9) can jndi be configured outside of tomcat ? in some other process ? 10) I mostly take part in small projects, where team leader/architect also deploys app in production, possibly jndi is much more handful in corporate environment, where war is shipped to admin dedicated tomcat administrator, who deploys it and configures jdbc connections, and he can't simply change spring configuration. 11) jndi in contrary to spring is a standard and each tomcat/app server admin knows it and knows where and how to configure it ? 12) in projects without dedicated tomcat administrator where team leader makes build and deploys it into production jndi is an excess, and it is better and more handful to use spring and maven profiles for dev and production environment ? 12b) in projects as in 12) there is no sense speaking about advantages of jndi, jndi can be skipped and spring can be used instead. 13) looking into http://docs.oracle.com/javase/1.5.0/docs/guide/jndi/jndi-dns.html would be possible in tomcat to map dns as a jndi provider ? would it work than that InitialContext.lookup("some_appropriate_dns_prefix" + "tomcat.apache.org") would return me ip address ?? 14) similar to 13) http://docs.oracle.com/javase/6/docs/technotes/guides/jndi/jndi-ldap.html would it be possible in tomcat to map some external ldap as a jndi provider ? would ctx.lookup("some_appropriate_ldap_prefix" + "cn=objects,ou=Sales/some/x/y/z"); query ldap ? 15) would 13) and 14) work in tomcat, if not would it work in eg jboss ? if so what are common "some_appropriate_dns_prefix" and "some_appropriate_ldap_prefix" ? 16) can we add both 13) dns and 14) ldap into tomcat as jndi providers, and both work in the same webapp with appropriate prefixes, and "java:comp/env/" still returns Resources from web.xml and from context.xml ? thx for reply in advance, regards Jakub