tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Wilkinson <w...@forethought.net>
Subject DataSourceRealm with MySQL
Date Fri, 22 Aug 2003 13:12:46 GMT
Hi,

I'm struggling with creating a DataSourceRealm with MySQL.
I'm running Tomcat 4.1.27-LE-jdk14 on Windows2K

First, I can get the following example to work:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

So, I don't think it's a MySQL thing.

I've tried the settings from Scott Stewart's email and it doesn't work:
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg99745.html

Here is my server.xml:

------------------------------  server.xml -------------------------
<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"/>

  <GlobalNamingResources>
    <Resource
       name="jdbc/authority"
       type="javax.sql.DataSource"
       auth="Container"/>

    <ResourceParams name="jdbc/authority">
      <parameter>
        <name>username</name>
        <value>mysql</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>mysql</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>com.mysql.jdbc.Driver</value>
      </parameter>
      <parameter>
         <name>url</name>
         <value>
            jdbc:mysql://localhost:3306/authority?autoReconnect=true
         </value>
      </parameter>
      <parameter>
         <name>removeAbandoned</name>
         <value>true</value>
      </parameter>
      <parameter>
        <name>removeAbandonedTimeout</name>
        <value>60</value>
      </parameter>
      <parameter>
         <name>logAbandoned</name>
         <value>true</value>
      </parameter>
      <parameter>
         <name>maxActive</name>
         <value>100</value>
      </parameter>
      <parameter>
         <name>maxIdle</name>
         <value>10000</value>
      </parameter>
      <parameter>
         <name>maxWait</name>
         <value>10000</value>
      </parameter>
    </ResourceParams>

     </GlobalNamingResources>

     <Service name="Tomcat-Standalone">

         <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" />

         <Engine name="Standalone" defaultHost="localhost" debug="99">

             <Logger className="org.apache.catalina.logger.FileLogger"
                 prefix="catalina_log." suffix=".txt"
                 timestamp="true"/>

             <Realm className="org.apache.catalina.realm.DataSourceRealm"
                 debug="99"
                 dataSourceName="java:/comp/env/jdbc/authority"
                 userTable="users"
                 userNameCol="user_name"
                 userCredCol="user_pass"
                 userRoleTable="user_roles"
                 roleNameCol="role_name"/>

             <Host name="localhost" debug="99" appBase="webapps"
                 unpackWARs="true" autoDeploy="true">

                 <Valve
                    className="org.apache.catalina.valves.AccessLogValve"
                    directory="logs"  prefix="localhost_access_log."
                    suffix=".txt"
                    pattern="common" resolveHosts="false"/>

                 <Logger
                   className="org.apache.catalina.logger.FileLogger"
                   directory="logs"  prefix="localhost_log."
                   suffix=".txt"
                   timestamp="true"/>

             </Host>

         </Engine>

     </Service>

</Server>

---------------------------------------------------------------------
Here is the error message I get from Tomcat when I use my server.xml above:

ServerLifecycleListener: Can't create mbean for realm
org.apache.catalina.realm.
DataSourceRealm@1f66cff

Note, I was able to the the JDBCRealm working fine.



Mime
View raw message