2013-06-29 163 views
1

我使用JBoss AS 7.1.1最終和我有一個問題,當我嘗試部署應用程序:錯誤當JBoss上部署Web應用程序AS 7

JBAS014775:新的失蹤/不滿意的依賴關係: 服務jboss.naming.context.java。「\ n \ t \ t \ tjava:jboss」.datasources。「carsDS \ n \ t \ t」

(missing)dependents:[service jboss.persistenceunit。「 springTest.war#carsPU「] 20:33:58,250錯誤[org.jboss.as.server.deployment.scanner](DeploymentScanner-threads - 1){」JBAS014653:複合操作 失敗並且 回滾。步驟失敗:「=> {」Operation step-2「 => {」JBAS014771:缺少/不可用依賴關係的服務「=> [」jboss.persistenceunit。\「springTest.war#carsPU \」jboss.naming.context的.java \ 「\ n \噸\噸\ tjava:JBoss的\」。數據源\ 「carsDS的\ n \噸\噸\」 缺少[jboss.persistenceunit \ 「springTest.war#carsPU \」 jboss.naming。 context.java \ 「\ n \ t \ t \ tjava:JBoss的\」。數據源\ 「carsDS的\ n \ t \ t \」]「]}}}

這是我standalone.xml文件:

<drivers> 
    <driver module="com.h2database.h2" name="h2"> 
     <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> 
    </driver> 
    <driver module="com.mysql" name="com.mysql"> 
     <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class> 
    </driver> 
</drivers> 
<datasource enabled="true" jndi-name="java:jboss/datasources/carsDS" 
    pool-name="carsDS"> 
    <connection-url>jdbc:mysql://localhost:3306</connection-url> 

    <driver>com.mysql</driver> 

    <pool> 
     <min-pool-size>10</min-pool-size> 
     <max-pool-size>100</max-pool-size> 
     <prefill>true</prefill> 
    </pool> 
    <security> 
     <user-name>michal</user-name> 
     <password>michal</password> 
    </security> 
    <statement> 
     <prepared-statement-cache-size>32</prepared-statement-cache-size> 
     <share-prepared-statements /> 
    </statement> 
</datasource> 

和persistence.xml中:

<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_1_0.xsd" 
    version="1.0"> 
    <persistence-unit name="carsPU" transaction-type="JTA" > 
     <provider>org.hibernate.ejb.HibernatePersistence</provider> 
     <jta-data-source> 
      java:jboss/datasources/carsDS 
     </jta-data-source> 
     <class>pl.springtest.carEntity</class> 
     <properties> 
      <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/> 
      <property name="hibernate.hbm2ddl.auto" value="create-drop" /> 
     </properties> 
    </persistence-unit> 
</persistence> 

請告訴我什麼是錯的。

+0

嘗試在persistence.xml中刪除'transaction-type =「JTA」',將'轉換爲''。 – acdcjunior

+0

還是一樣的...... – mjoger

+0

好吧,現在**撤消**我上面所說的。嘗試在standalone.xml中添加'jta =「true」': ' – acdcjunior

回答

1
service jboss.naming.context.java."\n\t\t\tjava:jboss".datasources."carsDS\n\t\t" 

這看起來很可疑。檢查注入數據源的地方是否有空白。