Hibernate möchte Schema zwei mal undeployen

Raphalon

Aktives Mitglied
Hallo!

beim Deployment eines EAR auf JBoss erhalte ich unten stehende Fehlermeldungen. Zunächst werden alle relevanten DB-Objekte erfolgreich gelöscht, dann aber versucht Hibernate wohl ein weiteres Mal die Objekte zu löschen. Dabei kommt es dann zu den Fehlermeldungen. Ich versuche das aktuelle auf einer Derby, das gleiche passiert aber auch auf einer Oracle.

Was kann man tun, damit das nicht geschieht? Habe ich irgendwo in meiner Anwendung einen Fehler?

Java:
08:59:29,054 INFO  [org.jboss.as.repository] (management-handler-thread - 24) JBAS014900: Content added at location c:\Daten\Programme\jboss-as-7.1.1.Final\standalone\data\content\bf\2db38dd51c1f63524027f2452304ac867984db\content
08:59:29,081 INFO  [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016009: Stopping weld service for deployment ab65BillingEAR.ear
08:59:29,086 INFO  [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011403: Stopping Persistence Unit Service 'ab65BillingEAR.ear/ab65BillingEJB.jar#billing_DS'
08:59:29,087 INFO  [org.jboss.as.jpa] (MSC service thread 1-8) JBAS011403: Stopping Persistence Unit Service 'ab65BillingEAR.ear/ab65BillingEJB.jar#sfImport_DS'
08:59:29,088 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-7) HHH000227: Running hbm2ddl schema export
08:59:29,089 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-8) HHH000227: Running hbm2ddl schema export
08:59:29,091 INFO  [stdout] (MSC service thread 1-7) Hibernate:
08:59:29,092 INFO  [stdout] (MSC service thread 1-7)     alter table DEBIT_POSITION
08:59:29,094 INFO  [stdout] (MSC service thread 1-7)         drop constraint FK41F4C33CEC5CF82A
 
[... weitere drop sequences und constraints (alle erfolgreich) ...]
 
08:59:29,860 INFO  [stdout] (MSC service thread 1-8) Hibernate:
08:59:29,861 INFO  [stdout] (MSC service thread 1-8)     drop table ACCOUNT
 
[... weitere drop tables (alle erfolgreich) ...]
 
08:59:30,365 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-8) HHH000230: Schema export complete
08:59:30,382 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment ab65BillingEJB.jar in 1325ms
08:59:30,396 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment ab65BillingEAR.ear in 1339ms
08:59:30,398 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "ab65BillingEAR.ear"
08:59:31,039 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "ab65BillingEJB.jar"
08:59:31,041 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment ab65BillingEJB.jar in 0ms
08:59:31,052 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment ab65BillingEAR.ear in 648ms
08:59:31,053 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "ab65BillingEAR.ear"
08:59:31,390 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "ab65BillingEJB.jar"
08:59:31,403 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for sfImport_DS
08:59:31,435 INFO  [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016002: Processing weld deployment ab65BillingEAR.ear
08:59:31,451 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016002: Processing weld deployment ab65BillingEJB.jar
08:59:31,454 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-6) JNDI bindings for session bean named DebitPositionTriggerBean in deployment unit subdeployment "ab65BillingEJB.jar" of deployment "ab65BillingEAR.ear" are as follows:
 
                java:global/ab65BillingEAR/ab65BillingEJB/DebitPositionTriggerBean!de.ab65.billing.ejbeans.billing.DebitPositionTrigger
                java:app/ab65BillingEJB/DebitPositionTriggerBean!de.ab65.billing.ejbeans.billing.DebitPositionTrigger
                java:module/DebitPositionTriggerBean!de.ab65.billing.ejbeans.billing.DebitPositionTrigger
                java:global/ab65BillingEAR/ab65BillingEJB/DebitPositionTriggerBean
                java:app/ab65BillingEJB/DebitPositionTriggerBean
                java:module/DebitPositionTriggerBean
 
08:59:31,465 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-6) JNDI bindings for session bean named SimpleInfoMailGatewayBean in deployment unit subdeployment "ab65BillingEJB.jar" of deployment "ab65BillingEAR.ear" are as follows:
 
                java:global/ab65BillingEAR/ab65BillingEJB/SimpleInfoMailGatewayBean!de.ab65.billing.ejbeans.mailing.SimpleInfoMailGatewayBean
                java:app/ab65BillingEJB/SimpleInfoMailGatewayBean!de.ab65.billing.ejbeans.mailing.SimpleInfoMailGatewayBean
                java:module/SimpleInfoMailGatewayBean!de.ab65.billing.ejbeans.mailing.SimpleInfoMailGatewayBean
                java:global/ab65BillingEAR/ab65BillingEJB/SimpleInfoMailGatewayBean
                java:app/ab65BillingEJB/SimpleInfoMailGatewayBean
                java:module/SimpleInfoMailGatewayBean
 
08:59:31,480 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016005: Starting Services for CDI deployment: ab65BillingEAR.ear
08:59:31,503 INFO  [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011402: Starting Persistence Unit Service 'ab65BillingEAR.ear/ab65BillingEJB.jar#sfImport_DS'
08:59:31,506 INFO  [org.jboss.as.ejb3] (MSC service thread 1-3) JBAS014142: Started message driven bean 'BillingSchedulerMessageDrivenBean' with 'hornetq-ra' resource adapter
08:59:31,507 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-5) HHH000204: Processing PersistenceUnitInfo [
                name: sfImport_DS
                ...]
08:59:31,585 INFO  [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-5) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
08:59:31,617 INFO  [org.hibernate.dialect.Dialect] (MSC service thread 1-5) HHH000400: Using dialect: org.hibernate.dialect.DerbyTenSevenDialect
08:59:31,618 WARN  [org.hibernate.dialect.DerbyDialect] (MSC service thread 1-5) HHH000430: The DerbyDialect dialect has been deprecated; use one of the version-specific dialects instead
08:59:31,620 WARN  [org.hibernate.dialect.DerbyDialect] (MSC service thread 1-5) HHH000328: Unable to load/access derby driver class sysinfo to check versions : org.apache.derby.tools.sysinfo from [Module "org.hibernate:main" from local module loader @69945ce (roots: c:\Daten\Programme\jboss-as-7.1.1.Final\modules)]
08:59:31,627 INFO  [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-5) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
08:59:31,629 INFO  [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-5) HHH000397: Using ASTQueryTranslatorFactory
08:59:31,798 INFO  [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-5) HHH000227: Running hbm2ddl schema export
08:59:31,801 INFO  [stdout] (MSC service thread 1-5) Hibernate:
08:59:31,803 INFO  [stdout] (MSC service thread 1-5)     alter table ACCOUNT
08:59:31,805 INFO  [stdout] (MSC service thread 1-5)         drop constraint FKE49F160D6D56FB9
 
08:59:31,813 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-5) HHH000389: Unsuccessful: alter table ACCOUNT drop constraint FKE49F160D6D56FB9
08:59:31,815 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-5) 'ALTER TABLE' kann nicht für 'ACCOUNT' ausgeführt werden, da dieses Objekt nicht vorhanden ist.
08:59:31,818 INFO  [stdout] (MSC service thread 1-5) Hibernate:
08:59:31,819 INFO  [stdout] (MSC service thread 1-5)     alter table ACCOUNT
08:59:31,824 INFO  [stdout] (MSC service thread 1-5)         drop constraint FKE49F160DC1DEB228
 
08:59:31,827 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-5) HHH000389: Unsuccessful: alter table ACCOUNT drop constraint FKE49F160DC1DEB228
08:59:31,830 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-5) 'ALTER TABLE' kann nicht für 'ACCOUNT' ausgeführt werden, da dieses Objekt nicht vorhanden ist.
08:59:31,832 INFO  [stdout] (MSC service thread 1-5) Hibernate:
08:59:31,838 INFO  [stdout] (MSC service thread 1-5)     alter table ACCOUNT
08:59:31,839 INFO  [stdout] (MSC service thread 1-5)         drop constraint FKE49F160D79F09A5C
 
[... weitere Fehler, auch Tabellen möchte Hibernate ein weiteres mal löschen ...]
persistence.xml
[XML]<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">

<persistence-unit name="sfImport_DS">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/ds_SF_Import</jta-data-source>
<class>de.ab65.billing.persistence.sfclasses.Account</class>
[... weitere Klassen ...]
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.dialect" value="org.hibernate.dialect.DerbyTenSevenDialect" />
<property name="hibernate.format_sql" value="true" />
</properties>
</persistence-unit>
</persistence>[/XML]
Inhalt ear
Code:
./ab65BillingEJB.jar
./lib/ab65BillingCommon.jar
./lib/ab65BillingDomain.jar
./lib/ab65BillingService.jar
./lib/org.eclipse.persistence.asm-3.3.1.v201206041142.jar
./lib/org.eclipse.persistence.core-2.4.0.jar
./lib/org.eclipse.persistence.moxy-2.4.0.jar
./META-INF/application.xml
./META-INF/MANIFEST.MF
./META-INF/maven/de.ab65.billing/ab65BillingEAR/pom.properties
./META-INF/maven/de.ab65.billing/ab65BillingEAR/pom.xml
application.xml
[XML]<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC
"-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
"http://java.sun.com/dtd/application_1_3.dtd">
<application>
<display-name>ab65BillingEAR</display-name>
<module>
<ejb>ab65BillingEJB.jar</ejb>
</module>
</application>[/XML]
 
Mach mal aus dem
Code:
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
nur
Code:
 <property name="hibernate.hbm2ddl.auto" value="create"/>
 
Ja, mit dieser Einstellung tauchen die Fehlermeldungen tatsächlich nicht mehr auf. Doch verstehe ich nicht warum. Bei "create-drop" werden die Tabellen anfänglich erstellt und beim Schließen der sessionFactory wieder entfernt. Bei einem Redeployment würde ich einfach nur wieder einen create erwarten. Habe mir die Doku zu dem Thema angesehen und auch manche Google-Ergebnisse, werde aber nicht schlau daraus.

Kann es sein, dass ein create immer zuerst einen drop ausführt und zwar unabhängig davon, ob der create in einem "create" oder einem "create-drop" konfiguriert ist?
 

Neue Themen


Zurück
Oben