我使用reg schema& amp设置数据库下载了JOBSS 6.2 EAP。我想 为JNDI做一些配置,所以我在standalone.xml中进行了一些更改
standalone.xml
<datasource jta="false" jndi-name="java:jboss/jdbc.ds.reg.nontx" pool-name="java:jboss/jdbc.ds.reg.nontx_Pool" enabled="true" use-java-context="true" use-ccm="false">
<connection-url>jdbc:mysql://localhost:3306/reg</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<background-validation>false</background-validation>
</validation>
</datasource>
我还添加了module.xml&amp; mysql-connector-java-5.1.28 in %JBOSS_HOME%\ modules \ system \ layers \ base \ com \ mysql文件夹
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.28.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
但是我在启动jboss时仍然遇到此错误
新的缺失/不满足的依赖项:service jboss.jdbc-driver.mysql (失踪)受抚养人:[服务 jboss.driver-demander。“java:jboss / jdbc.ds.reg.nontx”,服务 jboss.data源。 “的java:JBoss的/ jdbc.ds.reg.nontx”]
答案 0 :(得分:0)
您错过了错误所述的驱动程序部分:
新的缺失/不满足的依赖项:service jboss.jdbc-driver.mysql (丢失)...
在数据源部分,还应该有一个驱动程序块
这是oracle db的一个例子(mysql应遵循相同的模式):
<subsystem xmlns="urn:jboss:domain:datasources:1.1">
<datasources>
<datasource jta="false" jndi-name="java:/jdbc/doxee/staging_aggregation/dbsettings" pool-name="Doxee_sa" enabled="true" use-ccm="false">
<connection-url>jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=p4xd1-scan2.griffon.local)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=P4CRSIPRN.griffon.local)))</connection-url>
<driver>oracle</driver>
<security>
<user-name>DOXEE_SA</user-name>
<password>Z.3cv_7Auc</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.jdbc">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
</driver>
</drivers>
</datasources>
</subsystem>
并在module.xml中
<resources>
<resource-root path="ojdbc6.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
所以你可以看到
datasources -> datasource -> driver
指向由
定义的oracledatasources -> drivers -> driver -> name