tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frerk.Me...@Edeka.de
Subject RE: BUG? TC 5.0.xx: WEB-INF/classes/jndi.properties found but INITIAL_CONTEXT_FACTORY property gets overwritten by TC [Auf Viren geprüft]
Date Wed, 27 Oct 2004 15:03:35 GMT

Dear Yoav,

>>My understanding of J2EE standards is that the servlet container tries
>>to find the file jndi.properties on the application classpath and if
found
>>initializes the context environment with properties from there.

>I don't think this understanding is correct for containers and J2EE
servers.  IIRC you have to use the InitialContext construct with the >env
argument which has the initial context factory class name.

1. Tomcat (5.0.28,5.0.29beta) does search the jndi.properties on the
application classpath and finds it, since:
2. It reads my com.example.test.key=42 property
3. It reads my
java.naming.factory.object=com.sun.jndi.ldap.obj.LdapGroupFactory property
which does not get overwritten
4. Therefore I guess it reads my
java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory property too,
   but replaces it with org.apache.naming.java.javaURLContextFactory, I
presume for internal use and doesn't
   set it back to original.
5. If it finds two or more factories, specs say that they are to be
concatenated by colons (':'), and
  not - in contrast to the other properties - just take the first one.
  http://java.sun.com/j2se/1.4.2/docs/api/javax/naming/InitialContext.html
6. It does not throw a NoInitialContextException, even thought
InitialLdapContext(); is implemented as InitialLdapContext(null,null);
   so it gets some Context from somewhere:
   (ctx instanceof DirContext) even equals true!

So it tries to behave like I think it should behave, but fails due to what
I call a bug.
If it was illegal, it should give me an exception like
NoInitialContextException, when I call InitialLdapContext().

I would like to have a reference to a standards document where it says that
there is an
exception for containers and J2EE servers. I've searched this topic up and
down the
web and haven't found an exception. Instead Sun's Tutorial says:

http://java.sun.com/products/jndi/tutorial/beyond/env/context.html
"So the environment, effectively, is the union of the environment parameter
and all application resource files,
with the additional rule that some standard properties could be gotten from
applet parameters or system properties."

This topic was already discussed in 2001 for Tomcat 3.x on
JNDI-Interest@java.sun.com but coming
not to a solution, only a workaround:
http://archives.java.sun.com/cgi-bin/wa?A2=ind0107&L=jndi-interest&F=&S
=&P=2069

Since Tomcat is the reference implementation (of the spec) I would like to
have a behavior
according to the spec or a clarificaton of it.
And I want to specify my basic LDAP connection properties only in one place
with inheritance
for many webapps and overriding some properties if needed in application
specific jndi.properties.
Application specific property files cannot do that.

Many thanks for thinking about this one.

Frerk Meyer

EDEKA Aktiengesellschaft
GB Datenverarbeitung
Frerk Meyer
CC Web Technologien
New-York-Ring 6
22297 Hamburg
Tel: 040/6377 - 3272
Fax: 040/6377 - 41268
mailto:frerk.meyer@edeka.de




---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message