Jakarta ee 原因:com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException:连接不可用,等待180008超时

Jakarta ee 原因:com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException:连接不可用,等待180008超时,jakarta-ee,websphere,database-connection,connection-pooling,connection-timeout,Jakarta Ee,Websphere,Database Connection,Connection Pooling,Connection Timeout,我正在IBM WAS 7.0上运行我的多线程Struts应用程序,在峰值负载期间出现以下异常。最初,我将最大连接数配置为50,连接等待时间配置为180秒,但当我出现此错误时,我在做了大量的谷歌搜索以修复此问题后,将最大连接数更改为70,连接等待时间更改为600秒,但有时在峰值负载期间仍会出现此错误 原因:com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException:连接不可用,等待180008超时 请任何人帮我一下。可能有几个不同的问题会导致连接

我正在IBM WAS 7.0上运行我的多线程Struts应用程序,在峰值负载期间出现以下异常。最初,我将最大连接数配置为50,连接等待时间配置为180秒,但当我出现此错误时,我在做了大量的谷歌搜索以修复此问题后,将最大连接数更改为70,连接等待时间更改为600秒,但有时在峰值负载期间仍会出现此错误

原因:com.ibm.websphere.ce.j2c.ConnectionWaitTimeoutException:连接不可用,等待180008超时


请任何人帮我一下。

可能有几个不同的问题会导致连接超时值无法生效

您需要首先检查配置数据源的作用域中的resources.xml文件。确保连接超时值确实设置为600。WAS将使用此配置文件在服务器(JVM)重新启动时设置连接池值。对于您的数据源,您应该看到如下内容:

<connectionPool xmi:id="ConnectionPool_10000025" connectionTimeout="180" maxConnections="10" minConnections="1" reapTime="180" unusedTimeout="1800" agedTimeout="0" purgePolicy="EntirePool" numberOfSharedPoolPartitions="0" numberOfUnsharedPoolPartitions="0" numberOfFreePoolPartitions="0" freePoolDistributionTableSize="0" surgeThreshold="-1" surgeCreationInterval="0" testConnection="false" testConnectionInterval="0" stuckTimerTime="0" stuckTime="0" stuckThreshold="0"/>

如果此处未将该值设置为600,这就解释了180秒后连接仍超时的原因。您还应该能够验证最大连接数设置为多少。您可能希望使用管理控制台或wsadmin再次进行更改,然后重新启动服务器以验证更改是否生效。通常不建议手动更改这些值

如果该值设置为600,则需要检查是否未在多个作用域中配置具有相同名称的数据源。如果在多个作用域中配置,则需要确保所有作用域的值都已更改。应用服务器将使用在最低作用域配置的数据源的连接池设置。如果在服务器和集群范围内都配置了数据源,则将使用服务器范围的数据源。从最低作用域到最高作用域的顺序是:服务器<集群<节点<单元


如果没有在多个作用域中配置相同的数据源,并且该值设置为600,则在启动服务器时可能会出现其他问题,无法正确拾取数据源配置

可能有两个不同的问题会导致连接超时值无效

您需要首先检查配置数据源的作用域中的resources.xml文件。确保连接超时值确实设置为600。WAS将使用此配置文件在服务器(JVM)重新启动时设置连接池值。对于您的数据源,您应该看到如下内容:

<connectionPool xmi:id="ConnectionPool_10000025" connectionTimeout="180" maxConnections="10" minConnections="1" reapTime="180" unusedTimeout="1800" agedTimeout="0" purgePolicy="EntirePool" numberOfSharedPoolPartitions="0" numberOfUnsharedPoolPartitions="0" numberOfFreePoolPartitions="0" freePoolDistributionTableSize="0" surgeThreshold="-1" surgeCreationInterval="0" testConnection="false" testConnectionInterval="0" stuckTimerTime="0" stuckTime="0" stuckThreshold="0"/>

如果此处未将该值设置为600,这就解释了180秒后连接仍超时的原因。您还应该能够验证最大连接数设置为多少。您可能希望使用管理控制台或wsadmin再次进行更改,然后重新启动服务器以验证更改是否生效。通常不建议手动更改这些值

如果该值设置为600,则需要检查是否未在多个作用域中配置具有相同名称的数据源。如果在多个作用域中配置,则需要确保所有作用域的值都已更改。应用服务器将使用在最低作用域配置的数据源的连接池设置。如果在服务器和集群范围内都配置了数据源,则将使用服务器范围的数据源。从最低作用域到最高作用域的顺序是:服务器<集群<节点<单元


如果没有在多个作用域中配置相同的数据源,并且该值设置为600,则在启动服务器时可能会出现其他问题,无法正确拾取数据源配置

感谢您的澄清!您通常看到的消息表明连接池已达到最大值,出现这种情况的原因有很多

如果在增加最大连接池大小后仍存在此问题,则可能存在连接泄漏问题。通常情况下,如果应用程序未正确关闭连接,则无论您将最大连接大小增加多大,它都会填满连接池。如果连接池无法自行恢复并且服务器需要重新启动,则表明存在连接泄漏。应用程序应该遵循get/use/close模式,以避免连接泄漏问题

连接池最大化的另一个常见原因是数据库端存在性能问题。如果数据库未正确配置以处理WAS的负载,则可能导致连接池问题。如果存在长时间运行的查询,这也会导致WAS端的连接保持打开的时间更长

此外,如果您的应用程序不是专门为使用共享连接而设计的,并且WAS连接池使用的是共享连接,则可能会导致连接池最大化。默认情况下,WAS连接池设置为“共享”。如果应用程序不是专门为利用共享连接而设计的,则可能没有必要使用共享连接。您可以尝试更改为非共享连接,看看这是否会有所不同。为了对此有所帮助,应用程序必须在连接上调用close。通过将globalConnectionTypeOverride自定义属性设置为unshared,可以将连接更改为unshared。这可以通过以下链接(“控制连接池共享”部分)上的说明来完成:

该链接说明如下:

* Control connection pool sharing.
  You can use the defaultConnectionTypeOverride or globalConnectionTypeOverride connection pool custom property for a particular connection factory or data source to control connection sharing:
      o The defaultConnectionTypeOverride property changes the default sharing value for a connection pool. This property enables you to control connection sharing for direct queries. If resource references are configured for this data source or connection factory the resource reference's configurations take precedence over the defaultConnectionTypeOverride property settings. For example, if an application is doing direct queries and unshared connections are needed, set the defaultConnectionTypeOverride property to unshared.
      o The value specified for the globalConnectionTypeOverride custom property takes precedence over all of the other connection sharing settings. For example if you set this property to unshared, all connection requests are unshared for both direct queries and resource reference lookups. This property provides you with a quick way to test the consequences of moving all connections for a particular data source or connection factory to unshared or shared without changing any resource reference setting.

  If you specify values for both the defaultConnectionTypeOverride and the globalConnectionTypeOverride properties, only the values specified for the globalConnectionTypeOverride property are used to determine connection sharing type.
  To add these new custom properties to the settings for a data source or connection factory connection pool, a new connection pool custom property must be created. To add one of these properties to a data source, use the administrative console. Click Resources > JDBC > Data sources > select your data source from the list Additional properties > Connection pool properties > Connection pool custom properties > New. For other J2C or JMS connection factories, navigate to the connection factory definition in the administrative console. Then select Additional Properties > Connection pool > Connection pool custom properties > New. Now specify defaultConnectionTypeOverride or globalConnectionTypeOverride in the Name field and shared or unshared in the Value field.
  Important: The properties must be set in the Connection pool custom properties and not the general Custom propeties on the data source or connection factory.
你可以去看医生