2012-12-03 108 views
1

我試圖在Jboss 7.0.2上部署我的JBpm應用程序。JBoss 7.0.2上的部署錯誤

我爲jbpm和我的業務實體定義了一個持久性單元。 我使用Spring 3.1.3配置了事務管理器。

在Tomcat 7.0上一切正常,但是當我部署在Jboss 7.0.2上時,我得到一個javax.persistence.PersistenceException。

要修正這個錯誤,我添加了以下元素在我的堅持單位:

<mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file> 

但後來我得到另一個異常指的我的業務實體:

[...] 
Caused by: java.lang.IllegalArgumentException: Not an managed type: class  eu.publications.ceres.persistence.domain.Registration 
[...] 

你有一個想法爲什麼在tomcat上一切正常,並在JBoss不正常? JBoss在幕後做了什麼?

謝謝

的persistence.xml:

<persistence-unit name="ceres2013.persistence.unit"> 
    <provider>org.hibernate.ejb.HibernatePersistence</provider> 
    <mapping-file>META-INF/JBPMorm.xml</mapping-file> 

    <class>org.drools.persistence.info.SessionInfo</class> 
    <class>org.drools.persistence.info.WorkItemInfo</class> 
    <class>org.jbpm.process.audit.ProcessInstanceLog</class> 
    <class>org.jbpm.process.audit.NodeInstanceLog</class> 
    <class>org.jbpm.process.audit.VariableInstanceLog</class> 

    <properties> 
     <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /> 
     <property name="hibernate.show_sql" value="false" /> 
     <property name="hibernate.max_fetch_depth" value="4" /> 
     <property name="hibernate.hbm2ddl.auto" value="validate" /> 
    </properties> 
</persistence-unit> 

的applicationContext.xml:

<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> 
    <property name="entityManagerFactory" ref="entityManagerFactory" /> 
</bean> 
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> 
    <property name="dataSource" ref="dataSource" /> 
    <property name="persistenceUnitName" value="ceres2013.persistence.unit" /> 
</bean> 

堆棧跟蹤:

[...] 
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: ceres2013.persistence.unit] Unable to build EntityManagerFactory 
     at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:900) [hibernate-entitymanager-3.5.4-Final.jar:] 
     at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)  [hibernate-entitymanager-3.5.4-Final.jar:] 
     [...] 
Caused by: org.hibernate.HibernateException: Errors in named queries: ProcessInstancesWaitingForEvent 
     at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:437) [hibernate-core-3.5.4-Final.jar:] 

回答

1

幾周前我找到了解決方案。您的評論是正確的。 我必須將所有域實體添加到持久性單元中,因爲JBoss不查找@Entity註釋(Tomcat)。我結束了類似的東西:

<persistence-unit name="org.jbpm.persistence.jpa" transaction-type="RESOURCE_LOCAL"> 
    <provider>org.hibernate.ejb.HibernatePersistence</provider> 
    <mapping-file>META-INF/JBPMorm.xml</mapping-file> 
    <mapping-file>META-INF/ProcessInstanceInfo.hbm.xml</mapping-file> 

    <class>...</class> 
    ... 
    <class>...</class> 

    <properties> 
     <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /> 
     <property name="hibernate.show_sql" value="false" /> 
     <property name="hibernate.max_fetch_depth" value="4" /> 
     <property name="hibernate.hbm2ddl.auto" value="validate" /> 
    </properties> 

</persistence-unit> 
0

,你得到與相關的錯誤你的一個實體映射到persistence.xml文件中了嗎?

約造成的誤差:org.hibernate.HibernateException:錯誤的命名查詢:ProcessInstancesWaitingForEvent

,因爲你是用錯映射你正在使用Hibernate的版本映射ProcessInstanceInfo類可引起。

乾杯

PS:順便說一下,你跟5.4.0.Final測試?