首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 服务器 > 其他服务器 >

ssh+jbpm整合,快哭了。解决方法

2012-03-18 
ssh+jbpm整合,快哭了。。。最近新项目要用JBPM和SSH整合,搞了半天,就是整合不了,spring2.0+hibernate3.1+jbpm

ssh+jbpm整合,快哭了。。。
最近新项目要用JBPM和SSH整合,搞了半天,就是整合不了,spring2.0+hibernate3.1+jbpm3.14 用到的jar包spring-modules-jbpm31.jar,postgresql-8.0-310.jdbc3.jar,和jbpm3.14自带的包,
=======================================================================
spring的config文件如下:
=======================================================================
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">


<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="oracle.jdbc.driver.OracleDriver">
</property>
<property name="url"
value="jdbc:oracle:thin:@localhost:1521:xe">
</property>
<property name="username" value="rdy1983"></property>
<property name="password" value="6238135"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</prop>
<prop key="jdbc.fetch_size">50</prop>
  <prop key="jdbc.batch_size">30</prop>
  <prop key="hibernate.show_sql">true</prop>
  <prop key="hibernate.use_outer_join">true</prop>
  <prop key="hibernate.cglib.use_reflection_optimizer">
  true
  </prop>

</props>
</property>

<property name="mappingLocations">
  <list>
  <value>classpath:org/jbpm/db/hibernate.queries.hbm.xml</value>
<value>classpath*:/org/jbpm/**/*.hbm.xml</value>
</list>
  </property>
<property name="mappingResources">
<list>
<value>/com/sam/hibernate/model/Loginuser.hbm.xml</value></list>
</property>
</bean>
<!-- Transaction Manager -->
  <bean id="transactionManager"
  class="org.springframework.orm.hibernate3.HibernateTransactionManager">
  <property name="sessionFactory">
  <ref local="sessionFactory" />
  </property>
  </bean>
<!-- Transaction Interceptor 
  <bean id="transactionInterceptor"
  class="org.springframework.transaction.interceptor.TransactionInterceptor"
  dependency-check="none">
  <property name="transactionManager">
  <ref bean="transactionManager" />
  </property>
  <property name="transactionAttributes">
  <props>
  <prop key="save*">PROPAGATION_REQUIRED</prop>
  <prop key="update*">PROPAGATION_REQUIRED</prop>
  <prop key="attachDirty*">PROPAGATION_REQUIRED</prop>


  <prop key="delete*">PROPAGATION_REQUIRED</prop>
  default, readOnly 
  <prop key="*">PROPAGATION_REQUIRED,readOnly</prop>
  </props>
  </property>
  </bean>
-->
<!--reading jBPM process definitions -->
<bean id="simples"
  class="org.springmodules.workflow.jbpm31.definition.ProcessDefinitionFactoryBean">
  <property name="definitionLocation" value="classpath:/simple/processdefinition.xml"/>
   
  </bean>
<!-- jBPM configuration-->
  <bean id="jbpmConfiguration"
  class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
  <property name="sessionFactory" ref="sessionFactory" />
  <property name="configuration" value="WEB-INF/jbpm.cfg.xml" />
   
  <property name="processDefinitions">
  <list>  
  <ref bean="simples"/>
  </list> 
  </property>
   
  <property name="createSchema" value="false" />
  </bean>
  <!-- jBPM template -->
  <bean id="jbpmTemplate"
  class="org.springmodules.workflow.jbpm31.JbpmTemplate">
  <constructor-arg index="0" ref="jbpmConfiguration" />
  <constructor-arg index="1" ref="simples" />
  </bean>
<bean id="loginuserDAO"
class="com.sam.hibernate.dao.LoginuserDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
<property name="jbpmConfiguration">
<ref bean="jbpmConfiguration"/>
</property>
</bean>
<bean name="/user" class="com.sam.struts.action.UserAction"
abstract="false" lazy-init="default" autowire="default"
dependency-check="default">
<property name="loginuserDAO">
<ref local="loginuserDAO" />
</property>
</bean>
</beans>
===================================
hibernate.cfg.xml如下
===================================
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>

<session-factory>
<property name="connection.username">rdy1983</property>
<property name="connection.url">
jdbc:oracle:thin:@localhost:1521:xe
</property>
<property name="dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="connection.password">6238135</property>
<property name="connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>
<property name="myeclipse.connection.profile"></property>
<!-- ###################### -->
<!-- # jbpm mapping files # -->
<!-- ###################### -->


<!-- hql queries and type defs -->
<mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />

<!-- graph.def mapping files -->
  下面还有,帖子太长了下面省了

</session-factory>
</hibernate-configuration>
=======================================================================
启动TOMCAT 的时候,spring配置文件中,会部署一个工作流的实例,但总是部署失败,不在加载时部署,在程序中部署也是一样的错误,如下:
org.hibernate.MappingException: Named query not known: GraphSession.findLatestProcessDefinitionQuery
  at org.hibernate.impl.AbstractSessionImpl.getNamedQuery(AbstractSessionImpl.java:70)
at org.hibernate.impl.SessionImpl.getNamedQuery(SessionImpl.java:1224)
at org.jbpm.db.GraphSession.findLatestProcessDefinition(GraphSession.java:150)
at org.jbpm.db.GraphSession.deployProcessDefinition(GraphSession.java:67)
=====================================================
望高手指点,真的快哭了。。。。




[解决办法]
org.hibernate.MappingException

你的映射文件有错
我也出现这个问题

在hibernate.cfg.xml加入


<!-- graph.def mapping files -->
<mapping
resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml" />
<mapping resource="org/jbpm/graph/def/Node.hbm.xml" />
<mapping resource="org/jbpm/graph/def/Transition.hbm.xml" />
<mapping resource="org/jbpm/graph/def/Event.hbm.xml" />
<mapping resource="org/jbpm/graph/def/Action.hbm.xml" />
<mapping resource="org/jbpm/graph/def/SuperState.hbm.xml" />
<mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml" />
<mapping resource="org/jbpm/instantiation/Delegation.hbm.xml" />

<!-- graph.node mapping files -->
<mapping resource="org/jbpm/graph/node/StartState.hbm.xml" />
<mapping resource="org/jbpm/graph/node/EndState.hbm.xml" />
<mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml" />
<mapping resource="org/jbpm/graph/node/Decision.hbm.xml" />
<mapping resource="org/jbpm/graph/node/Fork.hbm.xml" />
<mapping resource="org/jbpm/graph/node/Join.hbm.xml" />
<mapping resource="org/jbpm/graph/node/State.hbm.xml" />
<mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml" />

热点排行