首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MySQL + WildFly 10.0 -一个或多个服务无法启动

MySQL + WildFly 10.0 -一个或多个服务无法启动
EN

Stack Overflow用户
提问于 2016-07-06 00:33:37
回答 1查看 4.4K关注 0票数 0

我试图在部署时与数据库连接,但遇到了一些问题,下面是代码和堆栈跟踪:

代码语言:javascript
复制
 02:19:32,740 ERROR [org.jboss.as.controller.management-operation]  (ServerService Thread Pool -- 45) WFLYCTL0013: Operation ("add") failed -  address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "mysql")
]) - failure description: "WFLYJCA0041: Failed to load module for driver   [org.mysql]"
02:19:32,814 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 55) WFLYUT0014: Creating file handler for path 'C:\Users  \Damian\wildfly-10.0.0.Final/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
02:19:32,839 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0012: Started server default-server.
 02:19:32,840 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) WFLYUT0018: Host default-host starting
02:19:32,925 INFO  [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing.
02:19:32,925 INFO  [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host.
02:19:33,157 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "FiranyCRM.war" (runtime-name: "FiranyCRM.war")
02:19:33,171 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "mysql-connector-java-5.1.37.jar" (runtime-name: "mysql-connector-java-5.1.37.jar")
02:19:33,186 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-5) WFLYDS0013: Started FileSystemDeploymentService for directory C:\Users\Damian\wildfly-10.0.0.Final\standalone\deployments
02:19:33,232 INFO  [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-6) ISPN000128: Infinispan version: Infinispan 'Mahou' 8.1.0.Final
 02:19:33,506 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
 02:19:33,771 INFO  [org.jboss.ws.common.management] (MSC service thread 1-8) JBWS022052: Starting JBossWS 5.1.3.Final (Apache CXF 3.1.4) 
02:19:33,827 INFO  [org.jboss.as.jpa] (MSC service thread 1-8) WFLYJPA0002: Read persistence.xml for firanyDS
02:19:33,880 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
02:19:33,882 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
02:19:33,916 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = mysql-connector-java-5.1.37.jar_com.mysql.jdbc.Driver_5_1
02:19:33,917 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = mysql-connector-java-5.1.37.jar_com.mysql.fabric.jdbc.FabricMySQLDriver_5_1
02:19:34,213 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "FiranyCRM.war")]) - failure description: {
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "jboss.persistenceunit.\"FiranyCRM.war#firanyDS\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jdbc.firanyDS]",
    "jboss.persistenceunit.\"FiranyCRM.war#firanyDS\" is missing [jboss.naming.context.java.jdbc.firanyDS]"
],
"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.\"FiranyCRM.war\".component.\"com.sun.faces.config.ConfigureListener\".START",
        "jboss.deployment.unit.\"FiranyCRM.war\".component.\"javax.faces.webapp.FacesServlet\".START",
        "jboss.deployment.unit.\"FiranyCRM.war\".component.\"javax.faces.webapp.FacetTag\".START",
        "jboss.deployment.unit.\"FiranyCRM.war\".component.\"javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV\".START",
        "jboss.deployment.unit.\"FiranyCRM.war\".component.\"javax.servlet.jsp.jstl.tlv.ScriptFreeTLV\".START",
        "jboss.deployment.unit.\"FiranyCRM.war\".component.\"managed-bean.com.firanycrm.controller.CurtainBean\".START",
        "jboss.deployment.unit.\"FiranyCRM.war\".component.\"managed-bean.com.firanycrm.controller.LoginBean\".START",
        "jboss.deployment.unit.\"FiranyCRM.war\".deploymentCompleteService",
        "jboss.deployment.unit.\"FiranyCRM.war\".jndiDependencyService",
        "jboss.naming.context.java.module.FiranyCRM.FiranyCRM.DefaultDataSource",
        "jboss.undertow.deployment.default-server.default-host./FiranyCRM",
        "jboss.undertow.deployment.default-server.default-host./FiranyCRM.UndertowDeploymentInfoService"
    ],
    "Services that may be the cause:" => [
        "jboss.jdbc-driver.mysql",
        "jboss.naming.context.java.jdbc.firanyDS"
    ]
}
}
02:19:34,214 ERROR [org.jboss.as.controller.management-operation]   (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "firanyDS")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.firanyDS is missing [jboss.jdbc-driver.mysql]",
"jboss.driver-demander.java:jboss/datasources/firanyDS is missing  [jboss.jdbc-driver.mysql]"
]}
02:19:34,216 ERROR [org.jboss.as.controller.management-operation]  (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "firanyDS")
]) - failure description: {
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
    "org.wildfly.data-source.firanyDS is missing [jboss.jdbc-   driver.mysql]",
    "jboss.driver-demander.java:jboss/datasources/firanyDS is missing   [jboss.jdbc-driver.mysql]",
    "org.wildfly.data-source.firanyDS is missing [jboss.jdbc- driver.mysql]"
],
"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.data-source.reference-factory.firanyDS",
        "jboss.naming.context.java.jboss.datasources.firanyDS"
    ],
    "Services that may be the cause:" => [
        "jboss.jdbc-driver.mysql",
        "jboss.naming.context.java.jdbc.firanyDS"
    ]
}
}

standalone.xml:

代码语言:javascript
复制
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
        <datasources>
            <datasource jndi-name="java:jboss/datasources/firanyDS" pool-name="firanyDS">
                <connection-url>jdbc:mysql://127.0.0.1:3307/firanycrm</connection-url>
                <driver>mysql</driver>
                <pool>
                    <min-pool-size>10</min-pool-size>
                    <max-pool-size>20</max-pool-size>
                    <prefill>true</prefill>
                </pool>
                <security>
                    <user-name>root</user-name>
                    <password>root</password>
                </security>
            </datasource>
            <drivers>
                <driver name="mysql" module="org.mysql">
                    <xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
                </driver>
            </drivers>
        </datasources>
    </subsystem>

module.xml (模块文件夹中的模块/org/mysql):

代码语言:javascript
复制
<module xmlns="urn:jboss:module:1.0" name="org.mysql.driver"> 
<resources> 
<resource-root path="mysql-connector-java-5.1.37.jar"/> 
</resources> 
<dependencies> 
 <module name="javax.api"/> 
 <module name="javax.transaction.api"/> 
</dependencies> 
</module> 

persistence.xml:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence  http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="firanyDS" transaction-type="RESOURCE_LOCAL">
<jta-data-source>java:/jdbc/firanyDS</jta-data-source>
    <properties>
        <property name="hibernate.dialect"  value="org.hibernate.dialect.MySQL5Dialect" />
    </properties>
</persistence-unit>
</persistence>

我在哪个地方犯了错?

EN

回答 1

Stack Overflow用户

发布于 2016-07-06 08:41:19

你至少有两个问题:

  1. 在standalone.xml中,在数据源子系统下,您将驱动程序模块设置为"org.mysql“,但是module.xml中的模块名称是"org.mysql.driver”。
  2. persistence.xml中的jta数据源元素应该是数据源的jndi名称:java:jboss/datasources/firanyDS。此外,由于您使用的是JTA,事务类型必须是"JTA“。
代码语言:javascript
复制
<persistence ...>
    <persistence-unit name="firanyDS" transaction-type="JTA">
        <jta-data-source>java:/jdbc/firanyDS</jta-data-source>
        <properties>
            <property name="hibernate.dialect"  value="org.hibernate.dialect.MySQL5Dialect" />
        </properties>
    </persistence-unit>
</persistence>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38214832

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档