简体   繁体   English

在JBoss AS 7上部署Web应用程序时出错

[英]Error when deploy web-application on JBoss AS 7

I use JBoss AS 7.1.1 final and I've one problem when I try to deploy the application: 我最终使用JBoss AS 7.1.1,尝试部署应用程序时遇到一个问题:

JBAS014775: New missing/unsatisfied dependencies: service jboss.naming.context.java."\\n\\t\\t\\tjava:jboss".datasources."carsDS\\n\\t\\t" 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 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.persistenceunit.\\"springTest.war#carsPU\\"jboss.naming.context.java.\\"\\n\\t\\t\\tjava:jboss\\".datasources.\\"carsDS\\n\\t\\t\\"Missing[jboss.persistenceunit.\\"springTest.war#carsPU\\"jboss.naming.context.java.\\"\\n\\t\\t\\tjava:jboss\\".datasources.\\"carsDS\\n\\t\\t\\"]"]}}} (缺失的)依赖项:[service jboss.persistenceunit。“ springTest.war#carsPU”] 20:33:58,250错误[org.jboss.as.server.deployment.scanner](DeploymentScanner-threads-1){“ JBAS014653:复合操作失败并回滚。失败的步骤:“ => {”操作步骤2“ => {” JBAS014771:缺少依赖项/不可用依赖项的服务“ => [” jboss.persistenceunit。\\“ springTest.war#carsPU \\ “jboss.naming.context.java \\”。\\ n \\吨\\吨\\ tjava: “数据源\\ ”“。缺少[jboss.persistenceunit \\” 的JBoss \\ carsDS的\\ n \\吨\\吨\\ springTest.war#carsPU \\ “jboss.naming.context.java \\”。\\ n \\吨\\吨\\ tjava: “数据源\\ ”的JBoss \\ carsDS的\\ n \\吨\\吨\\“]”]}}}

This is my standalone.xml file: 这是我的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>

and persistence.xml: 和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>

Please tell me what is wrong. 请告诉我有什么问题。

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

This looks suspicious. 这看起来很可疑。 Check if there's some whitespace in the place where you inject the datasource. 检查在您注入数据源的地方是否存在空白。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM