I created a new context named "tc4users" in order to test Tomcat authentication and 
authorization stuff.  I am able to get the basic tomcat-users.xml authentication 
working when I leave the UserDatabase resource in the <GlobalNamingResources> area and 
<Realm> beneath <Engine>.  When I try to move stuff into tc4users.xml, my context 
config file, I am getting errors.  For example, I left everything else the same and I 
moved <Realm> to tc4users.xml and I get the following error:

Oct 28, 2002 3:09:50 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on port 80
Starting service Tomcat-Standalone
Apache Tomcat/4.1.12
javax.naming.NamingException: Could not create resource factory, ClassNotFoundEx
ception:org.apache.catalina.users.MemoryUserDatabaseFactory

Below, I'm going to paste my conf/server.xml and webapps/tc4users.xml:
(Sorry, I use tabs.  I may have to switch to spaces, so I can post stuff.)

------------------------------------------

<Server 
        port="8005" 
        shutdown="SHUTDOWN" 
        debug="99"
>
        
  <!-- Global JNDI resources 
        description="User database that can be updated and saved"
        -->
  <GlobalNamingResources>
    <Resource
                        name="UserDatabase"
                        type="org.apache.catalina.UserDatabase"
                        auth="Container"
    />
    <ResourceParams name="UserDatabase">
      <parameter>
        <name>factory</name>
        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
      </parameter>
      <parameter>
        <name>pathname</name>
        <value>conf/tomcat-users.xml</value>
      </parameter>
    </ResourceParams>
  </GlobalNamingResources>
        
  <Service name="Tomcat-Standalone">
                
    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 80 -->
    <Connector
                        className="org.apache.coyote.tomcat4.CoyoteConnector"
      port="80"
                        minProcessors="5"
                        maxProcessors="75"
      enableLookups="true"
                        redirectPort="8443"
      acceptCount="10"
                        connectionTimeout="20000"
      useURIValidationHack="false"
                        debug="99"
                />

    <Engine
                        name="Standalone"
                        defaultHost="localhost"
                        debug="99"
                >
                        <!--
      <Realm 
                                className="org.apache.catalina.realm.UserDatabaseRealm"
        debug="0" 
                                resourceName="UserDatabase"
                        />
                        -->
      <Host 
                                name="localhost"
                                appBase="webapps"
        unpackWARs="true"
                                autoDeploy="true"
                        >
        <Logger 
                                        
className="org.apache.catalina.logger.FileLogger"
          directory="logs"  prefix="localhost_log." suffix=".txt"
                timestamp="true"
                                />
      </Host>
                        
    </Engine>
                
  </Service>
        
</Server>

------------------------------------------

<Context 
        path="/tc4users" 
        docBase="C:\Projects\tc4users\build" 
        debug="99"
>
        
        <Logger
                className="org.apache.catalina.logger.FileLogger"
                prefix="tc4users_log."
                suffix=".txt"
                timestamp="true"
        />
        
        <Realm 
                className="org.apache.catalina.realm.UserDatabaseRealm"
                debug="0" 
                resourceName="UserDatabase"
        />
</Context>
------------------------------------------

Any help would be greatly appreciated!

Cameron

On Mon, 28 Oct 2002 [EMAIL PROTECTED] wrote:

> Is it possible to use the tomcat-users.xml file within a particular context?  I have 
>been trying to do this, but I keep getting the error:
> 
> javax.naming.NameNotFoundException: Name UserDatabase is not bound in this Context
> 
> I put this within my context section:
> 
>       <Resources>
>               <Resource name="UserDatabase" auth="Container"
>                                                       
>type="org.apache.catalina.UserDatabase"
>                        description="User database that can be updated and saved">
>               </Resource>
>               <ResourceParams name="UserDatabase">
>                       <parameter>
>                               <name>factory</name>
>                               
><value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
>                       </parameter>
>                       <parameter>
>                               <name>pathname</name>
>                               <!--<value>conf/tomcat-users.xml</value>-->
>                               <value>WEB-INF/tomcat-users.xml</value>
>                       </parameter>
>               </ResourceParams>
>               
>       </Resources>
>       
>       <Realm 
>               className="org.apache.catalina.realm.UserDatabaseRealm"
>               debug="99" 
>               resourceName="UserDatabase"
>       />
> 
> I first tried it without the <Resources/> tag, but it didn't work either.  Any ideas 
>what is wrong.
> 
> Thanks,
> Cameron Taggart
> [EMAIL PROTECTED]
> 
> 



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

Reply via email to