Hi,

I've fot a couple of questions regarding Tomcat's JNDI implementation.

In the JNDI resources howto of Tomcat 5.5
(http://tomcat.apache.org/tomcat-5.5-doc/jndi-resources-howto.html) at
paragraph 'Adding Custom Resource Factories', just under '1. Write A
Resource Factory Class' one can read this:

...Every time your web application calls lookup() on a context entry that is
bound to this factory, the getObjectInstance() method is called...

I tried with Tomcat 5.5.17 and it seems that this statement is wrong:
getObjectInstance() only get called only at the first lookup() call then it
seems the result is cached somewhere by Tomcat to serve future request.

I also noticed that the 2nd parameter of getObjectInstance() method (Name
jndiNameObject) seems to loose the path information. Let me explain:

I've got a web app with this context.xml file located in the META-INF
folder:

<Context>

    <Environment name="config/someKey" value="someValue"
type="java.lang.String"/>

</Context>

The string get properly bound to the ENC so you can look it up with
ctx.lookup("java:comp/env/config/someKey");

Unfortunately, in the getObjectInstance() method the jndiNameObject
parameter only appears to be 'someKey'. It seems there is no way to find
back that it was bound as 'config/someKey'.

Is that on purpose ? Did I miss something ?

Another thing: is there a good reason why bindings configured in the
server.xml's GlobalNamingResources tag have to be linked by web app contexts
? Why isn't there a way to access this content using some global URL, like
"/config/someKey" ?

Last but not least, I found the answer to Remy's question:
http://www.nabble.com/Re%3A-UserTransaction%2C-JOTM-and-Tomcat-5.5.x-p2803063.html

Just do this to hijack the java: ENC:

System.setProperty("java.naming.factory.initial", "the.carol.factory");

Thanks in advance,
Ludovic
--
View this message in context: 
http://www.nabble.com/JNDI-Resource-Factories-questions-t1826017.html#a4980937
Sent from the Tomcat - User forum at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to