tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: UserDatabase resource into META-INF/context.xml
Date Thu, 06 Feb 2014 12:46:35 GMT
2014-02-06 Jose MarĂ­a Zaragoza <demablogia@gmail.com>:
> Hello:
>
> I'm using Tomcat 6.0.24
>
> I want to set a realm per only one application, so I define in its
> META-INF/context.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
> <Context>
> <Resource auth="Container"
>  description="User database that can be updated and saved"
>  factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
> name=MyUserDatabase"
>  pathname="conf/my-users.xml"
>  type="org.apache.catalina.UserDatabase" />
>
> <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
> resourceName="MyUserDatabase"/>
> </Context>
>
> my-users.xml is stored in $CATALINA_BASE/conf/
>
>
> But it doesn't work; a javax.naming.NameNotFoundException exception is
> thrown when Tomcat restarts
>
>
> If I put <Resource> under GlobalNamingResources in server.xml , works
> fine, But I would prefer to held all configuration in context.xml
>
> is it possible ? or do I need to use GlobalNamingResources ?

With the current code: no.
It is hardcoded to do JNDI lookup in the global context.

It might be possible to port "localDataSource" option from
DataSourceRealm class.
(MMV. It depends on what ClassLoader is active when
MyUserDatabase.startInternal() is invoked).

> is the pathname right ?

In general I'd prefer to write "${catalina.base}/conf/my-users.xml",
but that is just my preference.

Best regards,
Konstantin Kolinko

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


Mime
View raw message