2013-06-29 130 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" 

这看起来很可疑。检查注入数据源的地方是否有空白。