I have been trying to create a context xml file for a webapp so that
it encapsulates all needed server side configuration for authentication to work. That is, it contains both the <Realm> and <Resource> elements. I dont understand why the following definition of a context does not work (although does work when the <Resource> element is moved into server.xml): $ cat conf/Catalina/localhost/tomcatapp.xml <?xml version="1.0" encoding="UTF-8"?> <Context> <Resource name="MyUserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/myapp-users.xml" /> <Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="MyUserDatabase" /> </Context> This gives the error: javax.naming.NameNotFoundException: Name [MyUserDatabase] is not bound in this Context. Unable to find [MyUserDatabase]. The documentation shows that the <Resource> element is valid within a <Context>. Is it possible to do this? --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
On 29/01/2021 08:49, Karim Kanso wrote:
> I have been trying to create a context xml file for a webapp so that > it encapsulates all needed server side configuration for > authentication to work. That is, it contains both the <Realm> and > <Resource> elements. > > I dont understand why the following definition of a context does not > work (although does work when the <Resource> element is moved into > server.xml): > > $ cat conf/Catalina/localhost/tomcatapp.xml > <?xml version="1.0" encoding="UTF-8"?> > <Context> > <Resource > name="MyUserDatabase" > auth="Container" > type="org.apache.catalina.UserDatabase" > factory="org.apache.catalina.users.MemoryUserDatabaseFactory" > pathname="conf/myapp-users.xml" > /> > <Realm > className="org.apache.catalina.realm.UserDatabaseRealm" > resourceName="MyUserDatabase" > /> > </Context> > > This gives the error: > > javax.naming.NameNotFoundException: Name [MyUserDatabase] is not bound > in this Context. Unable to find [MyUserDatabase]. > > The documentation shows that the <Resource> element is valid within a > <Context>. Is it possible to do this? http://tomcat.apache.org/tomcat-9.0-doc/config/realm.html Search for "localDataSource" Mark --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
On Fri, 29 Jan 2021 at 09:23, Mark Thomas <[hidden email]> wrote:
> > On 29/01/2021 08:49, Karim Kanso wrote: > > I have been trying to create a context xml file for a webapp so that > > it encapsulates all needed server side configuration for > > authentication to work. That is, it contains both the <Realm> and > > <Resource> elements. > > > > I dont understand why the following definition of a context does not > > work (although does work when the <Resource> element is moved into > > server.xml): > > > > $ cat conf/Catalina/localhost/tomcatapp.xml > > <?xml version="1.0" encoding="UTF-8"?> > > <Context> > > <Resource > > name="MyUserDatabase" > > auth="Container" > > type="org.apache.catalina.UserDatabase" > > factory="org.apache.catalina.users.MemoryUserDatabaseFactory" > > pathname="conf/myapp-users.xml" > > /> > > <Realm > > className="org.apache.catalina.realm.UserDatabaseRealm" > > resourceName="MyUserDatabase" > > /> > > </Context> > > > > This gives the error: > > > > javax.naming.NameNotFoundException: Name [MyUserDatabase] is not bound > > in this Context. Unable to find [MyUserDatabase]. > > > > The documentation shows that the <Resource> element is valid within a > > <Context>. Is it possible to do this? > > http://tomcat.apache.org/tomcat-9.0-doc/config/realm.html > > Search for "localDataSource" > > Mark > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > Ah ok. Thankyou Mark. --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
Free forum by Nabble | Edit this page |