【发布时间】:2019-02-11 13:41:33
【问题描述】:
当我的应用程序服务器运行时,Jboss 无法连接到数据库。我正在运行 docker DB2 映像,而不是使用本地数据库。我在 Virtual Box 上运行 Docker。应用程序正在打开到 VirtualBox IP 而不是 localhost 的套接字。错误说:
错误说:
Cannot create PoolableConnectionFactory : Exception java.net.ConnectException: Error opening socket to server /192.168.56.1 on port 50,000 with message: Connection refused: connect. ERRORCODE=-4499, SQLSTATE=08001....其中 192.168.56.1 是我的 Virtual Box Ip。我可以通过在本地运行的 DB2 客户端连接我的 DB2 docker 映像,但不能与我的应用程序连接。
日志:
2019-02-11 18:20:16,806 INFO [ost-startStop-1 ation.ConfigurationClassParser] - Properties location [/opt/demandtec/common/conf/jms.properties] not resolvable: class path resource [opt/demandtec/common/conf/jms.properties] cannot be opened because it does not exist
2019-02-11 18:20:17,877 INFO [ost-startStop-1 redAnnotationBeanPostProcessor] - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-02-11 18:20:18,683 INFO [ost-startStop-1 dtec.message.DestReserverBeans] - Loading defalt queue topic definitions
2019-02-11 18:20:18,736 INFO [ost-startStop-1 mandtec.global.DTServiceConfig] - init jndi template
2019-02-11 18:20:18,764 INFO [ost-startStop-1 dtec.global.DTRemotingServices] - Start Locate Registry with port: 3099
2019-02-11 18:20:22,685 INFO [ost-startStop-1 ssage.activemq.DTAMQJmsService] - amq connect meta data created
2019-02-11 18:20:22,691 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: QueueConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,697 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: TopicConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,698 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: PromoCPQueueConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,698 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: PerishableQueueConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,698 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: AMEQueueConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,698 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: FarmQueueConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,720 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: IAMTopicConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,720 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: CTSQueueConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,721 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: GlobalQueueConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,722 INFO [ost-startStop-1 .message.InitConnectionFactory] - export: GlobalTopicConnectionFactory as interface com.ibm.demandtec.mq.RemoteConnectFactory
2019-02-11 18:20:22,731 INFO [ost-startStop-1 ndtec.mq.DTMQConnectionFactory] - Init class: org.apache.activemq.ActiveMQConnectionFactory, with: {brokerURL=tcp://IBM217-PC0BY3X9:61616, trustAllPackages=true}
2019-02-11 18:20:22,992 INFO [ost-startStop-1 ndtec.mq.DTMQConnectionFactory] - Init class: org.apache.activemq.ActiveMQConnectionFactory, with: {brokerURL=tcp://IBM217-PC0BY3X9:61616, clientID=IBM217-PC0BY3X9.IAM, trustAllPackages=true}
2019-02-11 18:20:23,357 WARN [ost-startStop-1 .commons.dbcp2.BasicDataSource] - The requested JMX name [demandtec.com_optimization] was not valid and will be ignored.
2019-02-11 18:20:53,117 INFO [pool-2-thread-1 .demandtec.global.DTMDBService] - Startup AdminMDB
2019-02-11 18:20:54,241 INFO [pool-2-thread-1 .demandtec.global.DTMDBService] - Startup IAM as clientid:IBM217-PC0BY3X9_appiam
2019-02-11 18:30:31,001 WARN [ost-startStop-1 emandtec.dal.ConnectionHandler] - JBossPoolException! Failed getting connection to Optimization for demandtec.com
2019-02-11 18:30:31,001 WARN [ost-startStop-1 emandtec.dal.ConnectionHandler] - cause: Cannot create PoolableConnectionFactory ([jcc][t4][2043][11550][4.22.29] Exception java.net.ConnectException: Error opening socket to server /192.168.56.1 on port 50,000 with message: Connection refused: connect. ERRORCODE=-4499, SQLSTATE=08001)
2019-02-11 18:30:31,001 WARN [ost-startStop-1 emandtec.dal.ConnectionHandler] - will attempt one more time.
2019-02-11 18:30:31,001 WARN [ost-startStop-1 .commons.dbcp2.BasicDataSource] - The requested JMX name [demandtec.com_optimization] was not valid and will be ignored.
数据库:DB2;操作系统:在 Oracle VirtualBox 上运行的 Windows7/ Docker;框架:J2EE;应用服务器:Jboss
【问题讨论】:
-
这可能是由很多原因造成的。您是否尝试过从容器中连接?然后从你的虚拟机中?
-
正如我所说,我可以通过在本地运行的 DB 客户端访问 DB2 映像,但连接时我的应用程序服务器显示此错误..
-
好的,所以,可能不是 docker 问题。配置错误?你有配置文件或一些代码要显示吗?
-
我正在开发的产品非常庞大..会花一些精力来查找数据库配置文件。你可以建议我在哪个方向进行调查或我可以采取哪些步骤。请在答案部分发布您的步骤,而不是评论。如果可行,您的 ans 可能会被接受。
-
我想,但我在这里做了很多猜测。什么框架?数据库类型?操作系统?答案可能具有误导性。当您尝试与 Jboss 连接时,是否有任何 DB2 日志,或者是否有其他东西拒绝访问?
标签: database docker networking jboss