通过将 jdbc 驱动程序安装为模块并在standalone.xml 中添加数据源定义,我成功地将 Jboss 7 配置为与 Oracle 11g 一起使用。但是,现在我想将数据源定义移动到它自己的文件中,该文件已放入部署目录中。这导致了以下失败:
javax.naming.NameNotFoundException: jdbc/MyDatasource -- service jboss.naming.context.java.jboss.jdbc.MyDatasource
jboss 7不再可能了吗?(我相信jboss 5曾经是这种情况)ds文件的外观如下:
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jndi-name="java:jboss/jdbc/MyDatasource" pool-name="OracleDS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:@oracle.host:1521:mydb</connection-url>
<driver>
oracle
</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<use-fast-fail>false</use-fast-fail>
</validation>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.jdbc"/>
</drivers>
</datasources>