2014-02-06 Jose María Zaragoza <demablo...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to