从EAP 7.0连接到Microsoft SQL时出现问题

时间:2019-03-04 15:33:27

标签: sql-server jdbc jboss datasource

我在standalone.xml中定义了我的JNDI数据源

<datasource jta="false" jndi-name="java:/dailymenu" pool-name="dailymenu" enabled="true">
   <connection-url>jdbc:sqlserver://<host>:<port>;DatabaseName=<db-name>;</connection-url>
   <driver>mssql</driver>
   <security>
      <user-name><username></user-name>
      <password><pw></password>
   </security>
</datasource>

在以下部分:

<driver name="mssql" module="com.mircosoft.sqlserver.jdbc">
   <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
</driver>

然后我在bojboss-eap-7.0⁩▸⁨modules⁩▸⁨com⁩▸⁨microsoft⁩▸⁨sqlserver⁩▸⁨jdbc⁩▸⁨main⁩(以及mssql- jdbc-7.2.1.jre8.jar)

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.microsoft.sqlserver.jdbc">
<resources>
    <resource-root path="mssql-jdbc-7.2.1.jre8.jar"/>
</resources>
<dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
</dependencies>
</module>

但是,当启动jBoss时,我得到了:

ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "dailymenu.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"dailymenu.war\".component.DailyMenuApplication.START" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"dailymenu.war\".component.DailyMenuApplication.START: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
Caused by: java.lang.IllegalStateException: WFLYEE0042: Failed to construct component instance
Caused by: javax.ejb.EJBException: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
Caused by: org.hibernate.engine.jndi.JndiException: Unable to lookup JNDI name [dailymenu]
Caused by: javax.naming.NameNotFoundException: dailymenu [Root exception is java.lang.IllegalStateException]
Caused by: java.lang.IllegalStateException"},
"WFLYCTL0288: One or more services were unable to start due to one or more indirect dependencies not being available." => {
    "Services that were unable to start:" => [
        "jboss.deployment.unit.\"dailymenu.war\".deploymentCompleteService",
        "jboss.deployment.unit.\"dailymenu.war\".moduleDeploymentRuntimeInformationStart",
        "jboss.undertow.deployment.default-server.default-host./dailymenu",
        "jboss.undertow.deployment.default-server.default-host./dailymenu.UndertowDeploymentInfoService"
    ],
    "Services that may be the cause:" => ["jboss.jdbc-driver.mssql"]
}
}

1 个答案:

答案 0 :(得分:0)

好,我有错字了。当然,驱动程序模块名称应与module.xml的路径完全匹配(不带“ main”)。