eclipse中tomcat的连接池配置可能有问题。
最好将相关配置代码贴出来看看

解决方案 »

  1.   

    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6392390
      

  2.   

    server.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <Server>
      <Listener className="org.apache.catalina.core.AprLifecycleListener"/>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
      <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
      <GlobalNamingResources>
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <Resource driverClassName="com.mysql.jdbc.Driver" maxActive="4" maxIdle="2" maxWait="5000" name="jdbc/mysql" password="19850401" type="javax.sql.DataSource" url="jdbc:mysql://localhost/sms" username="root"/>
        <Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
      </GlobalNamingResources>
      <Service name="Catalina">
        <Connector connectionTimeout="20000" maxSpareThreads="75" maxThreads="150" minSpareThreads="25" port="5050" redirectPort="8443">
        </Connector>
        <Connector port="8009" protocol="AJP/1.3" redirectPort="8443">
        </Connector>
        <Engine defaultHost="localhost" name="Catalina">
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
          <Host appBase="webapps" name="localhost">
          <Context docBase="myweb" path="/myweb" reloadable="true" source="org.eclipse.jst.j2ee.server:myweb"/></Host>
        </Engine>
      </Service>
    </Server>

    tomcat-users.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <tomcat-users>
      <role rolename="manager"/>
      <role rolename="tomcat"/>
      <role rolename="admin"/>
      <role rolename="role1"/>
      <user password="tomcat" roles="tomcat" username="tomcat"/>
      <user password="tomcat" roles="tomcat,role1" username="both"/>
      <user password="19850401" roles="admin,manager" username="mnzmx"/>
      <user password="tomcat" roles="role1" username="role1"/>
    </tomcat-users>context.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--
      Licensed to the Apache Software Foundation (ASF) under one or more
      contributor license agreements.  See the NOTICE file distributed with
      this work for additional information regarding copyright ownership.
      The ASF licenses this file to You under the Apache License, Version 2.0
      (the "License"); you may not use this file except in compliance with
      the License.  You may obtain a copy of the License at      http://www.apache.org/licenses/LICENSE-2.0  Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    -->
    <!-- The contents of this file will be loaded for each web application -->
    <Context>    <!-- Default set of monitored resources -->
        <WatchedResource>WEB-INF/web.xml</WatchedResource>
        <ResourceLink name="jdbc/mysql" global="jdbc/mysql"/>
        <!-- Uncomment this to disable session persistence across Tomcat restarts -->
        <!--
        <Manager pathname="" />
        --></Context>