Search code examples
javajpajbossdatasourcehsqldb

JBoss 7.1 Deployment Error using HSQL 2.2.9 as Datasource


Since a few Hours I am trying to find some bug I produced on my Java EE-Program. It uses an HSQLDB Datasource. When the Server (JBoss 7.1.1 final) starts, the Database can be found and all needed Tables are created correctly. But at the end ob the deployment I got following error:

21:36:43,502 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"BusinessLogic.jar#BusinessLogic\"jboss.naming.context.java.DefaultDSMissing[jboss.persistenceunit.\"BusinessLogic.jar#BusinessLogic\"jboss.naming.context.java.DefaultDS]"]}}}

DefaultDS is my Datasource. Except from my standalone.xml:

<datasource jta="true" jndi-name="java:jboss/DefaultDS" pool-name="DefaultDS"      enabled="true" use-java-context="true" use-ccm="true">
    <connection-url>jdbc:hsqldb:${jboss.server.data.dir}${/}localDB</connection-url>
    <driver>hsqldb</driver>
    <security>
        <user-name>sa</user-name>
        <password></password>
    </security>
    <pool>
        <prefill>false</prefill>
        <use-strict-min>false</use-strict-min>
        <flush-strategy>FailingConnectionOnly</flush-strategy>
    </pool>
    <security>
        <user-name>sa</user-name>
    </security>
</datasource>

I connect to this Database using JPA and my persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.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_1_0.xsd">
<persistence-unit name="BusinessLogic">
    <!-- Durch "java:/DefaultDS" wird dem JBoss angewiesen, die integrierte HSQLDB,
         die als "Default Datasource" eingebunden ist, für die Persistenz der
         Applikation zu verwenden -->
    <jta-data-source>java:/DefaultDS</jta-data-source>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
        <!--Die Eigenschaft "hibernate.hbm2ddl.auto" legt fest, wie mit bereits 
            bestehenden Tabellen verfahren werden soll. "create-drop" bedeutet, 
            dass alle Tabellen bei einem Deployment der Applikation gelöscht und 
            neu angelegt werden. Sobald sich an Ihrer Entity Beans nichts mehr
            ändert, kann hier auch "update" gewählt werden, damit bleiben einmal
            angelegte Daten erhalten.  -->
        <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <!-- create-drop -->
        <property name="hibernate.format_sql" value="false" />  
        <property name="hibernate.show_sql" value="false" /> 
    </properties>

</persistence-unit>
</persistence>

As I said, at the Start of the Server JPA is creating all Tables correctly, so I assume the JDBC Driver is okay and the Database is working.


Solution

  • Try this

    In your persistence.xml try changing

    java:/DefaultDS to java:jboss/DefaultDS