内容比较多,请看官耐心!
JBPM有自己的实体hibernate配置文件,我看到他们都在jbpm-jpdl.jar里面,
在网上查资料得到,这些配置与系统本身实体配置放在一起的话,得增加以下代码
- XML code
<property name="mappingJarLocations"> <list> <value>WEB-INF/lib/jbpm-jpdl.jar</value> </list> </property> <property name="mappingLocations"> <value>classpath*:/org/jbpm/**/*.hbm.xml</value> </property>
这样子,我的配置文件代码就变成这样子
- XML code
<property name="mappingJarLocations"> <list> <value>WEB-INF/lib/jbpm-jpdl.jar</value> </list> </property> <property name="mappingLocations"> <value>classpath*:/org/jbpm/**/*.hbm.xml</value> </property> <property name="mappingResources"> <list> <value> com/model/SsSysRole.hbm.xml </value> <value> com/model/SsSysUserRole.hbm.xml </value> <value> com/model/SsSysUser.hbm.xml </value> </list> </property>
这样子配置以后,系统启动后报错了,异常如下:
信息: Initializing Spring root WebApplicationContext
2012-7-10 17:22:36 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext-resources.xml]: Invocation of init method failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from input stream
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)