tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Madere, Colin" <colin.mad...@ieminc.com>
Subject GlobalNamingContext, Realm auth, postgres
Date Tue, 12 Aug 2003 01:20:04 GMT
Tomcat 4.1.27
PostgreSQL 7.3.4
pg73jdbc3.jar

Trying to use JNDI as a Realm source for both auth and data access for a
whole server, therefore trying as a GlobalNamingContext attribute.  No love.

* Set up as a JDBC Realm, auth works.
* Set up Datasource as JNDI Resource within <DefaultContext>, data access
works.

Move <Resource> and params to <GlobalNamingContext> and I get the "Name jdbc
is not bound in this Context" error.  Saw lots of refs to this error via
Google, but none relevant AFAICT.  (Do I look up resources in the global
context differently?  If so doesn't that kind of break the idea of it being
an abstractly defined data source?)

Anyone successfully using <GlobalNamingContext> for DataSources?
Using these components (Tomcat 4.1.x, postgreSQL)?

Change Realm from JDBC to DataSourceRealm and auth does not work (or report
any errors in logs).

server.xml (with DataSourceRealm commented out)

<Server port="8005" shutdown="SHUTDOWN" debug="0">

  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
            debug="0"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
            debug="0"/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

  </GlobalNamingResources>

  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Tomcat-Standalone">

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8080" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="100" debug="0" connectionTimeout="20000"
               useURIValidationHack="false" disableUploadTimeout="true" />
    <!-- Note : To disable connection timeouts, set connectionTimeout value
     to -1 -->

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
    <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8009" minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="10" debug="0" connectionTimeout="0"
               useURIValidationHack="false"
 
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>

    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Standalone" defaultHost="localhost" debug="0">

      <!-- Global logger unless overridden at lower levels -->
      <Logger className="org.apache.catalina.logger.FileLogger"
              prefix="catalina_log." suffix=".txt"
              timestamp="true"/>

      <!-- Because this Realm is here, an instance will be shared globally
-->
      <!--
      <Realm className="org.apache.catalina.realm.DataSourceRealm"
debug="99"
             dataSourceName="java:/comp/env/jdbc/Auth"
             userTable="Account" userNameCol="username"
userCredCol="password"
             userRoleTable="AccountRole" roleNameCol="role_name"/>
      -->

      <Realm className="org.apache.catalina.realm.JDBCRealm" debug="99"
            driverName="org.postgresql.Driver"
         connectionURL="jdbc:postgresql://localhost/www_auth"
        connectionName="www"
             userTable="Account" userNameCol="username"
userCredCol="password"
         userRoleTable="AccountRole" roleNameCol="role_name"/>

      <!-- Define the default virtual host -->
      <Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
autoDeploy="true">

        <Valve className="org.apache.catalina.authenticator.SingleSignOn"
debug="0"/>

        <Logger className="org.apache.catalina.logger.FileLogger"
directory="logs"
                   prefix="localhost_log." suffix=".txt" timestamp="true"/>
        <!--
          <Context path="" docBase="ROOT" debug="0"/>
        -->
        <DefaultContext>
          <Resource name="jdbc/Auth" auth="Container"
type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/Auth">
            <parameter>
              <name>factory</name>
              <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
            <parameter>
              <name>maxActive</name>
              <value>100</value>
            </parameter>
            <parameter>
              <name>maxIdle</name>
              <value>30</value>
            </parameter>
            <parameter>
              <name>maxWait</name>
              <value>10000</value>
            </parameter>
            <parameter>
              <name>username</name>
              <value>www</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value></value>
            </parameter>
            <parameter>
              <name>driverClassName</name>
              <value>org.postgresql.Driver</value>
            </parameter>
            <parameter>
              <name>url</name>
              <value>jdbc:postgresql://localhost/www_auth</value>
            </parameter>
          </ResourceParams>
        </DefaultContext>
      </Host>
    </Engine>
  </Service>
</Server>

Mime
View raw message