2012-12-03 92 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测试?