我正在使用 Fat JAR Builder 运行 Thorntail。我正在尝试让数据源示例工作。
我使用 SQLClient 测试了两个 mySQL/Oracle 连接,它们工作正常。但我无法使用 Thorntail 应用程序获取数据源。在这两种情况下,连接都被拒绝。
这是 Yaml 配置。
ORACLE :
swarm:
datasources:
data-sources:
ExampleDS:
driver-name: oracle
connection-url: jdbc:oracle:thin:@HOST:PORT/SERVICE
user-name: USER
password: PWD
valid-connection-checker-class-name: org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker
validate-on-match: true
background-validation: false
stale-connection-checker-class-name: org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker
exception-sorter-class-name: org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter
这是相关日志-
... 11 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:150)
at oracle.net.nt.ConnOption.connect(ConnOption.java:133)
at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:370)
... 16 more
MYSQL 连接也是如此
yaml
swarm:
datasources:
jdbc-drivers:
com.mysql:
driver-class-name: com.mysql.jdbc.Driver
xa-datasource-class-name: com.mysql.jdbc.jdbc2.optional.MysqlXADataSource
driver-module-name: com.mysql
data-sources:
ExampleDS:
driver-name: com.mysql
connection-url: jdbc:mysql://HOST:3306/dbname
user-name: user
password: pwd
相关日志
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298)