数時間以来、Java EE プログラムで作成したバグを見つけようとしています。HSQLDB データソースを使用します。サーバー (JBoss 7.1.1 final) が起動すると、データベースが検出され、必要なすべてのテーブルが正しく作成されます。しかし、デプロイメントの最後に、次のエラーが発生しました。
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 は私のデータソースです。私のを除いて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>
JPA と 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>
私が言ったように、サーバーの起動時にJPAはすべてのテーブルを正しく作成しているので、JDBCドライバーは問題なく、データベースは機能していると思います。