我正在使用wildfly-10.1.0.Final并尝试添加oracle Datasource:
<datasource jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true">
<connection-url>jdbc:oracle:thin:@localhost:1523/pdborcl</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
</datasource>
和司机:
<driver name="oracle" module="com.oracle.ojdbc">
<driver-class>oracle.jdbc.OracleDriver</driver-class>
</driver>
我在modules / com / oracle / ojdbc / main下有一个模块:
<module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc">
<resources>
<resource-root path="ojdbc7.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
但是当我启动服务器时,我得到了:
11:14:30,226 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "OracleDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.oracle"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.OracleDS is missing [jboss.jdbc-driver.oracle]",
"jboss.driver-demander.java:jboss/datasources/OracleDS is missing [jboss.jdbc-driver.oracle]"
]
}
11:14:30,228 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "OracleDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.jdbc-driver.oracle",
"jboss.jdbc-driver.oracle"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.OracleDS is missing [jboss.jdbc-driver.oracle]",
"jboss.driver-demander.java:jboss/datasources/OracleDS is missing [jboss.jdbc-driver.oracle]",
"org.wildfly.data-source.OracleDS is missing [jboss.jdbc-driver.oracle]"
]
我已经阅读了所有类似的主题,包括这一个:Unable to define oracle datasource on Jboss AS 7。但是,我似乎无法找到解决方案。
答案 0 :(得分:0)
正如我在上面的评论中所述,我遇到了同样的问题 - 我在Wildfly 8上工作的驱动模块不能在wildfly 10下工作。
我现在有一个解决方法(/解决方案?) - 请参阅https://docs.jboss.org/author/display/WFLY10/DataSource+configuration:
我只是像使用EAR或WAR一样部署了ojdbc7.jar(使用了管理员前端http://localhost:9990)。
我的服务器然后识别出驱动程序
WFLYJCA0004:部署符合JDBC的驱动程序类 oracle.jdbc.OracleDriver(版本12.1)启动了驱动程序服务 driver-name = ojdbc7-12.1.0.1.jar
我可以定义非XA数据源(配置 - &gt;子系统 - &gt;数据源)并且它可以工作。 我真的不知道这个部署是否有任何缺点。但我的arquillian测试用例似乎有效。
在wildfly 10中,我没有看到编辑现有数据源的任何可能性,服务器要求我重新启动每个配置更改.... admin gui中缺少用于验证连接等的配置选项?
答案 1 :(得分:0)
另一种方法:
登录WildFly CLI
./jboss-cli.sh -c
部署Oracle JDBC驱动程序
deploy /path_to_the_file/ojdbc7.jar
创建一个配置了一个连接池的JDBC数据源
data-source add \
--name=MyOracleDataSource \
--jndi-name=java:/datasources/MyOracleDataSource \
--driver-name=ojdbc7.jar \
--driver-class=oracle.jdbc.OracleDriver \
--connection-url=jdbc:oracle:thin:@ORACLE_SERVER_NAME:1521/ORACLE_SERVICE_NAME \
--user-name=ORACLE_USER_NAME \
--password=ORACLE_USER_PASSWORD \
--allocation-retry=3 \
--background-validation=true \
--background-validation-millis=60000 \
--capacity-incrementer-class=org.jboss.jca.core.connectionmanager.pool.capacity.WatermarkIncrementer \
--capacity-decrementer-class=org.jboss.jca.core.connectionmanager.pool.capacity.WatermarkDecrementer \
--check-valid-connection-sql='SELECT 1 FROM dual' \
--connectable=false \
--enlistment-trace=true \
--exception-sorter-class-name=org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter \
--flush-strategy=EntirePool \
--jta=true \
--initial-pool-size=2 \
--min-pool-size=2 \
--max-pool-size=5 \
--mcp=org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool \
--pool-prefill=true \
--pool-use-strict-min=true \
--set-tx-query-timeout=false \
--share-prepared-statements=false \
--spy=false \
--stale-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker \
--statistics-enabled=true \
--track-statements=NOWARN \
--tracking=false \
--use-ccm=true \
--use-fast-fail=false \
--use-java-context=true \
--valid-connection-checker-class-name=org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker \
--enabled=true