-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Dude,
On 1/21/13 11:32 PM, sry...@jsrsys.com wrote: >> Why don't you show us what you've got, and we can suggest some >> improvements? > > Thank you. This one is in localhost: <Context path="/"> <!-- > put this one in localhost add path because of "Context path is > required" error--> What do you mean "in localhost"? Please give full paths. Unless it's in server.xml, it shouldn't have a "path" attribute. This is in 5.0.x, and I can't remember how it all worked way back then. You really need to upgrade. > <ResourceLink name="jdbc/MySql" type="javax.sql.DataSource" > global="jdbc/MySqlDB" /> If you have your <Resource> (below) defined within the <Context>, you don't need a <ResourceLink>. Also, it appears that you have defined this DataSource twice: once locally and once globally. > <!-- below all copied from ...conf context.xml file--> What does ...conf context.xml mean? Again, please give a full path. > <WatchedResource>WEB-INF/web.xml</WatchedResource> <Resource > name="jdbc/MySql" auth="Container" type="javax.sql.DataSource" > url="jdbc:mysql://localhost/autoReconnect=true" > factory="org.apache.commons.dbcp.BasicDataSourceFactory" Don't specify the factory unless you really want to be absolutely sure that factory gets used. Tomcat knows what factory to use by default, and I believe what you have there is the default. > Below is near top of server.xml in conf directory <!-- Global JNDI > resources --> <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"/> Do you need Tomcat's UserDatabase? Check to see if you do. > <Resource auth="Container" name="jdbc/MySqlDB" > type="javax.sql.DataSource"/> Do you really need a globally-accessible DataSource? How many webapps do you have? They all use the same username/password and same database? You want a shared connection pool for them all? > <ResourceParams name="UserDatabase"> <parameter> > <name>factory</name> > <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value> WTF? > </parameter> <parameter> <name>pathname</name> > <value>conf/tomcat-users.xml</value> </parameter> > </ResourceParams> <ResourceParams name="jdbc/MySqlDB"> <parameter> > <name>factory</name> > <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> You are specifying the "factory" twice. Stop that. > </parameter> <parameter> <name>url</name> > <value>jdbc:mysql://localhost/autoReconnect=true</value> Read the MySQL Connector/J manual about "autoReconnect". Remember you are using a connection pool which is already capable of testing connections and re-connecting for you. > <parameter> <name>maxActive</name> <value>3</value> <!-- so will > fail early if sql.close() missing --> </parameter> The comment here does not make any sense. If you want to catch connections that aren't returned to the pool, you'll want to use the "abandoned" capabilities of the pool. See http://commons.apache.org/dbcp/configuration.html - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.17 (Darwin) Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEAREIAAYFAlD+o8MACgkQ9CaO5/Lv0PDrcQCgpErUILnl9O+YTx5kM8ROxKC4 H+8AnjRd2mPg8BL0XIF9jZQz8ySxEcj+ =1l4p -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org