tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Salonen, Aki" <>
Subject Accessing Tomcat 4.03 JNDI service from LoginModule
Date Fri, 31 May 2002 09:53:00 GMT

I'm following problem:

I have JAAS LoginModule that uses JNDI to lookup DataSource object.
My LoginModule and LoginConfiguration implementation classes are located
in Tomcat's classpath. 

I tried first to put JAAS related classes under [TOMCAT-HOME]/common/lib,
but that caused exception:"Unable to load LoginConfiguration".

I'm using JAAS authentication directly from a servlet, so I'm using no
Tomcat realms in authentication.
Servlet just calls:

	LoginContext lc = new LoginContext( jaasApplName,
customUserPasswordCallbackHandler );
	lc.login( );

Everything works fine until LoginModule tries to lookup datasource
after obtaining InitialContext with 

		InitialContext initCtx = new InitialContext( );
		DataSource ds = (javax.sql.DataSource) initCtx.lookup(
dataSourceName );

I got exception with message : "Name MIPCoreDS is not bound in this

MIPCoreDS is configured in Tomcats configuration file server.xml under
<GlobalNamingResources> tag. 

Should this be visible for JAAS Login module or not?
When servlet's make same lookup under Tomcat, datasource is found fine.
It seems that loginModules have no visibility to JNDI objects configured
under Tomcat. 
Is this right?

Any help is appreciated.

Best Regards,


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message