Tomcat 连接池由 sql 服务器 2008 和 2012 重置
Tomcat connection pooling reset by sql server 2008 and 2012
我有 5 个不同的模块使用 Tomcat 连接池连接 sql 服务器 2008 和 2012。
在Tomcat7\conf\context.xml
<Resource auth="Container" driverClassName="net.sourceforge.jtds.jdbc.Driver" logAbandoned="true" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/testservice2" password="abc" removeAbandoned="true" removeAbandonedTimeout="60" type="javax.sql.DataSource"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor" username="abc"/>
模块 1 - 在 Tomcat7\conf\localhost\Module1.XML
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/Module1">
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60"
username="abc" password="abc" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor"/>
模块 2 - 在 Tomcat7\conf\localhost\Module2.XML
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/Module2">
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60"
username="abc" password="abc" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor"/>
</Context>
模块 3 - 在 Tomcat7\conf\localhost\Module3.XML
<Context antiJARLocking="true" path="/Module3">
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60"
username="abc" password="abc" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor"/>
</Context>
模块 4 - 在 Tomcat7\conf\localhost\Module4.XML
<Context antiJARLocking="true" path="/Module4">
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60"
username="abc" password="abc" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor"/>
</Context>
我在 QA 服务器和登台服务器上遇到以下错误?
2015 年 4 月 6 日 07:43:28 错误 DBAccess:49 - I/O 错误:对等方重置连接:套接字写入错误
我的 Tomcat 7 连接池配置有什么问题?为什么它被 sql 服务器拒绝
您正在尝试同时使用所有模块,其中您定义了具有相同名称的 'Resource',即 name="jdbc/testdb" 据我所知,这个名称必须是唯一的,因为它是jndi 与您赋予 name 属性的值绑定(参见 tomcat 文档 https://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Definitions )。如果您在不同的模块(Web 应用程序)中定义同名的数据源,请注意它们不会同时使用。在您的服务器某处发生这种情况。为了安全起见,请为 'Resource' 使用不同的名称。
另一件事是 'Resource' with name="jdbc/testservice2" 用于您提到的五个模块中的任何一个。因为我没有看到你的五个模块中的任何一个与这个 'Resource'.
有联系
我有 5 个不同的模块使用 Tomcat 连接池连接 sql 服务器 2008 和 2012。
在Tomcat7\conf\context.xml
<Resource auth="Container" driverClassName="net.sourceforge.jtds.jdbc.Driver" logAbandoned="true" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/testservice2" password="abc" removeAbandoned="true" removeAbandonedTimeout="60" type="javax.sql.DataSource"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor" username="abc"/>
模块 1 - 在 Tomcat7\conf\localhost\Module1.XML
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/Module1">
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60"
username="abc" password="abc" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor"/>
模块 2 - 在 Tomcat7\conf\localhost\Module2.XML
<?xml version="1.0" encoding="UTF-8"?>
<Context antiJARLocking="true" path="/Module2">
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60"
username="abc" password="abc" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor"/>
</Context>
模块 3 - 在 Tomcat7\conf\localhost\Module3.XML
<Context antiJARLocking="true" path="/Module3">
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60"
username="abc" password="abc" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor"/>
</Context>
模块 4 - 在 Tomcat7\conf\localhost\Module4.XML
<Context antiJARLocking="true" path="/Module4">
<Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000" removeAbandoned="true" removeAbandonedTimeout="60"
username="abc" password="abc" driverClassName="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost;databaseName=testdb;SelectMethod=Cursor"/>
</Context>
我在 QA 服务器和登台服务器上遇到以下错误? 2015 年 4 月 6 日 07:43:28 错误 DBAccess:49 - I/O 错误:对等方重置连接:套接字写入错误
我的 Tomcat 7 连接池配置有什么问题?为什么它被 sql 服务器拒绝
您正在尝试同时使用所有模块,其中您定义了具有相同名称的 'Resource',即 name="jdbc/testdb" 据我所知,这个名称必须是唯一的,因为它是jndi 与您赋予 name 属性的值绑定(参见 tomcat 文档 https://tomcat.apache.org/tomcat-7.0-doc/config/context.html#Resource_Definitions )。如果您在不同的模块(Web 应用程序)中定义同名的数据源,请注意它们不会同时使用。在您的服务器某处发生这种情况。为了安全起见,请为 'Resource' 使用不同的名称。 另一件事是 'Resource' with name="jdbc/testservice2" 用于您提到的五个模块中的任何一个。因为我没有看到你的五个模块中的任何一个与这个 'Resource'.
有联系