gpt4 book ai didi

jakarta-ee - Caused by : com. ibm.websphere.ce.j2c.ConnectionWaitTimeoutException : Connection not available, 等待180008超时

转载 作者:行者123 更新时间:2023-12-02 04:19:02 24 4
gpt4 key购买 nike

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

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

请任何人帮助我。

最佳答案

感谢您的澄清!您看到的消息通常表示连接池已用完,发生这种情况的原因有很多。

如果在增加最大连接池大小后问题仍然存在,则可能存在连接泄漏问题。通常,如果应用程序没有正确关闭连接,无论您将最大连接大小增加多高,它都会填满连接池。连接泄漏的一个很好的指示是连接池是否无法自行恢复并且需要重新启动服务器。应用程序应遵循获取/使用/关闭模式以避免连接泄漏问题。

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

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

http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-dist&topic=tdat_conpoolman

此链接说明如下:

* 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.

您还可以查看以下链接以获取有关这些属性的更多信息:

http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-dist&topic=rdat_conpoolcustprops

以下链接提供了一些关于非共享连接与共享连接的背景信息:

http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-nd-dist&topic=conshrnon

关于jakarta-ee - Caused by : com. ibm.websphere.ce.j2c.ConnectionWaitTimeoutException : Connection not available, 等待180008超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31795217/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com