1
votes

I use JBoss AS 7.1.1 final and I've one problem when I try to deploy the application:

JBAS014775: New missing/unsatisfied dependencies: service 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\"]"]}}}

This is my standalone.xml file:

<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 
    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.

1
Try removing transaction-type="JTA" in the persistence.xml, turning <persistence-unit name="carsPU" transaction-type="JTA" > into <persistence-unit name="carsPU">. - acdcjunior
Ok, now undo what I said above. Try adding jta="true" in the standalone.xml: <datasource enabled="true" jndi-name="java:jboss/datasources/carsDS" pool-name="carsDS" jta="true"> - acdcjunior
Thanks for answer, I really appreciate you help, but problem isn't disappear - mjoger
OK, one last try. Remove the jta="true" I just told you and add a use-java-context="true" in the same place. Also, for this try, remove transaction-type="JTA". - acdcjunior
If that above does not work, try, in the persistence.xml, removing those line breaks in <jta-data-source>. MAke it just in one line:, like <jta-data-source>java:jboss/datasources/carsDS</jta-data-source> - acdcjunior

1 Answers

2
votes
  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.