1

JBoss プロジェクトで mysql データベースをセットアップしようとしています。JBAS014775 に関するエラーが表示されます: New missing/unsatisfied dependencies. SOに関する無数の投稿を読みましたが、これらの問題が発生する理由はまだわかりません。コンソールからのエラーログを下に貼り付けました

モジュール ファイルは次のようになります。

<?xml version = "1.0" encoding = "UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.23-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>

persistence.xml は次のようになります。

<persistence version="2.0"
    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">
    <persistence-unit name="primary">
        <!-- If you are running in a production environment, add a managed 
            data source, this example data source is just for development and testing! -->
        <!-- The datasource is deployed as WEB-INF/greeter-quickstart-ds.xml, 
            you can find it in the source at src/main/webapp/WEB-INF/greeter-quickstart-ds.xml -->
        <jta-data-source>java:jboss/datasources/GreeterQuickstartDS</jta-data-source>
        <properties>
            <!-- Properties for Hibernate -->
                    <property name="hibernate.show_sql" value="true"/>
         <property name="hibernate.hbm2ddl.auto" value="update"/>
         <property name="hibernate.use_sql_comments" value="true"/>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
        </properties>
    </persistence-unit>
</persistence>

greeter-quickstart-ds.xml は次のように表示されます。

<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
    <!-- The datasource is bound into JNDI at this location. We reference 
        this in META-INF/persistence.xml -->
    <datasource jndi-name="java:jboss/datasources/GreeterQuickstartDS"
        pool-name="greeter-quickstart" enabled="true" use-java-context="true">
        <connection-url>jdbc:mysql://localhost:3306/jboss</connection-url>
        <driver>mysql</driver>
        <security>
            <user-name>root</user-name>
            <password>root</password>
        </security>
    </datasource>
</datasources>

standalone.xml は次のように表示されます。

 <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                 <datasource jndi-name="java:jboss/datasources/MySqlDS" pool-name="MySqlDS" enabled="true" use-java-context="true" use-ccm="true">
                    <connection-url>jdbc:mysql://localhost:3306/jboss</connection-url>
                    <driver>mysql</driver>
                    <security>
                        <user-name>root</user-name>
                        <password>root</password>
                    </security>
                    <statement>
                        <prepared-statement-cache-size>100</prepared-statement-cache-size>
                        <share-prepared-statements>true</share-prepared-statements>
                    </statement>
                </datasource>
                <drivers>
                <driver name="h2" module="com.h2database.h2">
                    <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                </driver>
                <driver name="mysql" module="com.mysql">
                    <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MySqlXADataDource</xa-datasource-class>
                </driver>
            </drivers>
            </datasources>


02:04:44,660 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
02:04:44,706 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
02:04:45,369 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/MySqlDS]
02:04:45,371 INFO  [org.jboss.as.server.deployment.scanner] (MSC service thread 1-8) JBAS015012: Started FileSystemDeploymentService for directory /opt/jboss-as-7.1.0.Final/standalone/deployments
02:04:45,373 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
02:04:45,377 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015014: Re-attempting failed deployment greeter.war


02:04:45,476 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 2540ms - Started 138 of 210 services (70 services are passive or on-demand)
02:04:45,491 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "greeter.war"
02:04:45,816 INFO  [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011401: Read persistence.xml for primary
02:04:45,900 INFO  [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016002: Processing weld deployment greeter.war

02:04:46,332 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "greeter.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/GreeterQuickstartDSjboss.jdbc-driver.mysql-connector-java-5_1_23-bin_jarMissing[jboss.data-source.jboss/datasources/GreeterQuickstartDSjboss.jdbc-driver.mysql-connector-java-5_1_23-bin_jar]"]}
02:04:46,348 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010409: Unbound data source [jboss/datasources/GreeterQuickstartDS]
02:04:46,354 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment greeter.war in 22ms
02:04:46,355 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.jdbc-driver.mysql-connector-java-5_1_23-bin_jar (missing) dependents: [service jboss.data-source.jboss/datasources/GreeterQuickstartDS] 

├── google
│   └── guava
│       └── main
│           ├── guava-10.0.1.jar
│           ├── guava-10.0.1.jar.index
│           └── module.xml
├── h2database
│   └── h2
│       └── main
│           ├── h2-1.3.161.jar
│           ├── h2-1.3.161.jar.index
│           └── module.xml
├── mysql
│   └── main
│       ├── module.xml
│       ├── mysql-connector-java-5.1.23-bin.jar
│       └── mysql-connector-java-5.1.23-bin.jar.index
└── sun
    ├── jsf-impl
    │   ├── 1.2
    │   │   ├── jsf-impl-1.2_15-jbossorg-2.jar
    │   │   └── module.xml
    │   └── main
    │       ├── jsf-impl-2.1.5-jbossorg-1.jar
    │       ├── jsf-impl-2.1.5-jbossorg-1.jar.index
    │       └── module.xml
    └── xml
        ├── bind
        │   └── main
        │       ├── jaxb-impl-2.2.4.jar
        │       ├── jaxb-impl-2.2.4.jar.index
        │       ├── jaxb-xjc-2.2.4.jar
        │       ├── jaxb-xjc-2.2.4.jar.index
        │       └── module.xml
        └── messaging
            └── saaj
                └── main
                    ├── module.xml
                    ├── saaj-impl-1.3.16-jbossorg-1.jar
                    └── saaj-impl-1.3.16-jbossorg-1.jar.index


02:04:46,356 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.data-source.jboss/datasources/GreeterQuickstartDSjboss.jdbc-driver.mysql-connector-java-5_1_23-bin_jarMissing[jboss.data-source.jboss/datasources/GreeterQuickstartDSjboss.jdbc-driver.mysql-connector-java-5_1_23-bin_jar]"]}}}
4

2 に答える 2

1

<driver>com.mysql</driver>jar 名全体ではなく、ドライバーの一意の名前のみを指定する必要があります。あなたの場合<driver>mysql</driver>、ある定義とjar名全体が別の定義にあります。

詳細については、データソースのセットアップ方法についてこちらを参照してください

于 2013-03-03T03:41:10.350 に答える
0

これで、mysql db に接続できました。もともと、standalone.xml ファイルを手動で調整してデータソースを追加していました。これをしないことをお勧めします。代わりに、JBoss が提供する管理 Web コンソールを使用してデータソースを追加する必要があります。

于 2013-03-03T19:31:01.103 に答える