WAS集群系列(2):数据库连接低级错误网络连接问题
环境 项目点 指标 WAS版本 7.0 应用服务器操作系统 Windows 2008 应用服务器系统位数 64bit 数据库服务器操作系统 CentOS 5.6 数据库版本 Oracle 11.0.2.1 今天搭建WAS集群后,发布应用程序包及启动均成功,但在测试数据库连接时提示,不成功,建议查看KVM日
环境
项目点 |
指标 |
WAS版本 |
7.0 |
应用服务器操作系统 |
Windows 2008 |
应用服务器系统位数 |
64bit |
数据库服务器操作系统 |
CentOS 5.6 |
数据库版本 |
Oracle 11.0.2.1 |
今天搭建WAS集群后,发布应用程序包及启动均成功,但在测试数据库连接时提示,不成功,建议查看KVM日志。
于是到日志路径下查看相关日志(此处参考为D:\IBM\WebSphere\AppServer\profiles\AppSrv01\logs\server1\SystemOut.log),信息如下:
[14-9-3 16:34:08:609 CST] 0000001d DataSourceCon E DSRA8040I: 无法连接到 DataSource。遇到 "":java.sql.SQLException: The Network Adapter could not establish the connectionDSRA0010E: SQL 状态:61000,错误码:20。 at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412) at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531) at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503) at oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280) at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:139) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:88) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:70) at com.ibm.ws.rsadapter.DSConfigurationHelper$2.run(DSConfigurationHelper.java:1704) at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5263) at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5441) at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255) at com.ibm.ws.rsadapter.DSConfigurationHelper$3.run(DSConfigurationHelper.java:1720) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:1732) at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:1627) at com.ibm.ws.rsadapter.DSConfigurationHelper.getConnectionFromDSOrPooledDS(DSConfigurationHelper.java:3370) at com.ibm.ws.rsadapter.DSConfigurationHelper.getConnectionFromDSOrPooledDS(DSConfigurationHelper.java:3245) at com.ibm.ws.rsadapter.DSConfigurationHelper.testConnectionForGUI(DSConfigurationHelper.java:4105) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at com.ibm.ws.management.DataSourceConfigHelperMBean.testConnectionToDataSource2(DataSourceConfigHelperMBean.java:556) at com.ibm.ws.management.DataSourceConfigHelperMBean.testConnection(DataSourceConfigHelperMBean.java:484) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:600) at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:244) at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1074) at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:955) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761) at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1331) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1224) at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:181) at com.ibm.ws.management.connector.ipc.CallRouter.route(CallRouter.java:242) at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink.doWork(IPCConnectorInboundLink.java:353) at com.ibm.ws.management.connector.ipc.IPCConnectorInboundLink$IPCConnectorReadCallback.complete(IPCConnectorInboundLink.java:595) at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165) at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217) at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161) at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138) at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204) at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775) at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1613) Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:359) at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422) at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:672) at oracle.net.ns.NSProtocol.connect(NSProtocol.java:237) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301) ... 55 more Caused by: java.net.ConnectException: Connection refused: connect at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:370) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:232) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:219) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:528) at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:141) at oracle.net.nt.ConnOption.connect(ConnOption.java:123) at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:337) ... 60 more 。 [14-9-2 16:34:27:921 CST] 0000005f NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:35:27:921 CST] 00000060 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:36:27:921 CST] 00000061 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:37:27:937 CST] 00000062 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:38:27:937 CST] 00000063 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:39:27:937 CST] 00000064 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:40:27:921 CST] 00000065 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:41:27:953 CST] 00000066 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:42:27:921 CST] 00000067 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:43:27:937 CST] 00000068 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:44:27:937 CST] 00000069 NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:45:27:921 CST] 0000006a NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:46:27:937 CST] 0000006b NodeSyncTask A ADMS0003I: 配置同步成功完成。 [14-9-2 16:47:27:921 CST] 0000006c NodeSyncTask A ADMS0003I: 配置同步成功完成。
虽然这么冗长的日志信息,但问题锁定到第一行,“The Network Adapter could not establish the connectionDSRA0010E”,这个问题按理说是常规问题,但由于进行了一个下午的各种配置设置,脑袋有些晕了。看到这个问题后,整个思路都跑偏了。现在将其记录,引以为戒。
错误的思考:
1、看到“The Network Adapter”,肯定是网络问题,想到是不是WAS集群两台服务器网卡问题,进行对数据库服务器及集群服务器互相ping通测试,ping通状态正常;
2、查看WAS数据源配置信息,开始检查各节点服务,重启各节点服务及HTTP服务等等,有些碰运气的胡乱尝试了,这个结果就是我的思路被自己彻底弄乱了;
3、于是接下来,做了更可笑的事,查看WAS集群下配置信息,怀疑数据源连接问题,对数据源格式由原来的“jdbc:oracle:thin:@10.53.105.64:1521:hyl”改为“jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.53.105.64)(PORT =1521)))(CONNECT_DATA = (SERVICE_NAME =hyl)))”。这里想的是因为网络连接问题,怀疑可能是集群服务器无法完成连接,可能是解析出问题了,于是修改成完整格式。测试数据库连接,依旧不成功。这里问题就出现了,忽略了简单的问题,把问题越想越复杂化了。
更正后的思考:
其实由上面第一点开始,就有些跑偏了,ping通测试后,应该最先想到的就是去看下数据库监听起来没有。而我完全忽略了这点,原因很简单,因为这台数据库服务器之前连接着单节点的WAS,连接测试没有问题,也就笃定了监听没有问题。就这么小的地方,自己有没有亲自去验证,而引发问题的复杂化。当发现数据库监听没有起来时才意识到,问题出在了这里,原来是当停止单实例WAS时,数据库服务器被重启过,而且该服务器上的监听并没有设置自动启动。说来是如此的简单。于是我启动监听,将之前改动过的测试恢复回刚刚配置完成后的常规设置状态,WAS数据源测试连接,结果两节点测试连接通过。
小结:
1、处理问题时,正确的思路比胡乱的尝试重要,只有方向对了才会“药到病除”,否则可能会“火上浇油”,把自己思路都弄乱了。
2、在技术上,记住了“The Network Adapter couldnot establish…”出现时,切记ping测试后,检查监听状态,确认后再做进一步分析。
***********************************************声明************************************************
原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明出处(http://blog.csdn.net/huangyanlong)。
表述有错误之处,请您留言或邮件(hyldba@163.com)指明,不胜感激。
*****************************************************************************************************

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Table of Contents Solution 1 Solution 21. Delete the temporary files of Windows update 2. Repair damaged system files 3. View and modify registry entries 4. Turn off the network card IPv6 5. Run the WindowsUpdateTroubleshooter tool to repair 6. Turn off the firewall and other related anti-virus software. 7. Close the WidowsUpdate service. Solution 3 Solution 4 "0x8024401c" error occurs during Windows update on Huawei computers Symptom Problem Cause Solution Still not solved? Recently, the web server needs to be updated due to system vulnerabilities. After logging in to the server, the update prompts error code 0x8024401c. Solution 1

1. Check the wifi password: Make sure the wifi password you entered is correct and pay attention to case sensitivity. 2. Confirm whether the wifi is working properly: Check whether the wifi router is running normally. You can connect other devices to the same router to determine whether the problem lies with the device. 3. Restart the device and router: Sometimes, there is a malfunction or network problem with the device or router, and restarting the device and router may solve the problem. 4. Check the device settings: Make sure the wireless function of the device is turned on and the wifi function is not disabled.

The Xiaomi Mi 15 series is expected to be officially released in October, and its full series codenames have been exposed in the foreign media MiCode code base. Among them, the flagship Xiaomi Mi 15 Ultra is codenamed "Xuanyuan" (meaning "Xuanyuan"). This name comes from the Yellow Emperor in Chinese mythology, which symbolizes nobility. Xiaomi 15 is codenamed "Dada", while Xiaomi 15Pro is named "Haotian" (meaning "Haotian"). The internal code name of Xiaomi Mi 15S Pro is "dijun", which alludes to Emperor Jun, the creator god of "The Classic of Mountains and Seas". Xiaomi 15Ultra series covers

Since the Huawei Mate60 series went on sale last year, I personally have been using the Mate60Pro as my main phone. In nearly a year, Huawei Mate60Pro has undergone multiple OTA upgrades, and the overall experience has been significantly improved, giving people a feeling of being constantly new. For example, recently, the Huawei Mate60 series has once again received a major upgrade in imaging capabilities. The first is the new AI elimination function, which can intelligently eliminate passers-by and debris and automatically fill in the blank areas; secondly, the color accuracy and telephoto clarity of the main camera have been significantly upgraded. Considering that it is the back-to-school season, Huawei Mate60 series has also launched an autumn promotion: you can enjoy a discount of up to 800 yuan when purchasing the phone, and the starting price is as low as 4,999 yuan. Commonly used and often new products with great value

How to use MySQLi to establish a database connection in PHP: Include MySQLi extension (require_once) Create connection function (functionconnect_to_db) Call connection function ($conn=connect_to_db()) Execute query ($result=$conn->query()) Close connection ( $conn->close())

Hibernate polymorphic mapping can map inherited classes to the database and provides the following mapping types: joined-subclass: Create a separate table for the subclass, including all columns of the parent class. table-per-class: Create a separate table for subclasses, containing only subclass-specific columns. union-subclass: similar to joined-subclass, but the parent class table unions all subclass columns.

Apple's latest releases of iOS18, iPadOS18 and macOS Sequoia systems have added an important feature to the Photos application, designed to help users easily recover photos and videos lost or damaged due to various reasons. The new feature introduces an album called "Recovered" in the Tools section of the Photos app that will automatically appear when a user has pictures or videos on their device that are not part of their photo library. The emergence of the "Recovered" album provides a solution for photos and videos lost due to database corruption, the camera application not saving to the photo library correctly, or a third-party application managing the photo library. Users only need a few simple steps

HTML cannot read the database directly, but it can be achieved through JavaScript and AJAX. The steps include establishing a database connection, sending a query, processing the response, and updating the page. This article provides a practical example of using JavaScript, AJAX and PHP to read data from a MySQL database, showing how to dynamically display query results in an HTML page. This example uses XMLHttpRequest to establish a database connection, send a query and process the response, thereby filling data into page elements and realizing the function of HTML reading the database.
