commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ramon Garcia" <ra...@bergueda.org>
Subject Unable to create and use a Connection Pool
Date Thu, 14 Jul 2005 12:57:28 GMT
Hi,
I have a problem tring to create and use a connection pool, I'm using Tomcat
5.0.28 and MySQL.
I followed the examples of the  "JNDI Datasource HOW-TO" But when I use it
the server shows a "javax.naming.NameNotFoundException"
My conifuration files are like:

CATALINA_HOME/conf/server.xml
--------------------------------
<?xml version='1.0' encoding='utf-8'?>
<Server>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <GlobalNamingResources>
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
    <Resource auth="Container" description="User database that can be
updated and saved" name="UserDatabase"
type="org.apache.catalina.UserDatabase"/>
    <Resource name="jdbc/ramon" type="javax.sql.DataSource"/>
    <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>
    <ResourceParams name="jdbc/ramon">
      <parameter>
        <name>validationQuery</name>
        <value>select * from pista;</value>
      </parameter>
      <parameter>
        <name>maxWait</name>
        <value>5000</value>
      </parameter>
      <parameter>
        <name>maxActive</name>
        <value>4</value>
      </parameter>
      <parameter>
        <name>password</name>
        <value>client</value>
      </parameter>
      <parameter>
        <name>url</name>
        <value>jdbc:mysql://localhost:3306/proves</value>
      </parameter>
      <parameter>
        <name>driverClassName</name>
        <value>org.gjt.mm.mysql.Driver</value>
      </parameter>
      <parameter>
        <name>maxIdle</name>
        <value>2</value>
      </parameter>
      <parameter>
        <name>username</name>
        <value>client</value>
      </parameter>
    </ResourceParams>
  </GlobalNamingResources>
  <Service name="Catalina">
    <Connector acceptCount="100" connectionTimeout="20000"
disableUploadTimeout="true" port="8080" redirectPort="8443"
maxSpareThreads="75" maxThreads="150" minSpareThreads="25">
    </Connector>
    <Connector port="8009" protocol="AJP/1.3"
protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"
redirectPort="8443">
    </Connector>
    <Engine defaultHost="localhost" name="Catalina">
      <Host appBase="webapps" name="localhost">
        <Logger className="org.apache.catalina.logger.FileLogger"
prefix="localhost_log." suffix=".txt" timestamp="true"/>
      </Host>
      <Logger className="org.apache.catalina.logger.FileLogger"
prefix="catalina_log." suffix=".txt" timestamp="true"/>
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
    </Engine>
  </Service>
</Server>
--------------------------------

conf/Catalina/localhost/myapp.xml
--------------------------------
<?xml version='1.0' encoding='utf-8'?>
<Context docBase="prova" path="/prova"
workDir="work\Catalina\localhost\prova">
<ResourceLink name="jdbc/ramon" type="javax.sql.DataSource"
global="jdbc/ramon"/>
  <Logger className="org.apache.catalina.logger.FileLogger" prefix="prova."
timestamp="true"/>

</Context>
--------------------------------

and finally the web.xml file:
...
  <resource-ref>
    <description>Prova BD</description>
    <res-ref-name>jdbc/ramon</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
..

What is my problem? I forgot to do something?

Thanks and Best Regards.

Ramon Garcia


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message