Hi,
I've got a bunch of code written that uses Hibernate entities using Annotations. I'm using Spring to provide the SessionFactory and I'm developing in Eclipse. (I mention these points, because I'm wondering if I'm having a similar problem to
http://forum.hibernate.org/viewtopic.php?t=966926&highlight=parse). Until now, everything has worked well.
Recently, I dropped jBPM into my environment, and am trying to set up the jBPM entities in the same SessionFactory. My Spring configuration now includes references to two Hibernate cfg files, as follows:
Code:
<bean id="org.hibernate.SessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="javax.sql.DataSource" />
<property name="configLocations">
<list>
<value>classpath:hibernate.cfg.xml</value>
<value>classpath:hibernate.investorportal.cfg.xml</value> -->
</list>
</property>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration</value>
</property>
<property name="namingStrategy">
<bean class="org.hibernate.cfg.ImprovedNamingStrategy" />
</property>
<property name="hibernateProperties">
<props>
<!-- Echo all executed SQL to stdout -->
<prop key="hibernate.bytecode.provider">javassist</prop>
<prop key="hibernate.show_sql">true</prop>
<!-- Drop and re-create the database schema on startup -->
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
Now, I can't run my tests. Specifically, it appears that, for some reason, the Configuration can't parse the jBPM-supplied hbm files.
Hibernate version: 3.2.0 GA
Full stack trace of any exception that occurs:Code:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.hibernate.SessionFactory' defined in file [C:\workspace\example\WebRoot\WEB-INF\applicationContext.xml]: Initialization of bean failed; nested exception is org.hibernate.InvalidMappingException: Could not parse mapping document from resource org/jbpm/db/hibernate.queries.hbm.xml
org.hibernate.InvalidMappingException: Could not parse mapping document from resource org/jbpm/db/hibernate.queries.hbm.xml
at org.hibernate.cfg.Configuration.addResource(Configuration.java:523)
at org.hibernate.cfg.AnnotationConfiguration.parseMappingElement(AnnotationConfiguration.java:524)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1479)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1458)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1432)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1367)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:651)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1091)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:396)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at com.example.dao.impl.DAOTestCase.getSessionFactory(DAOTestCase.java:64)
at com.example.dao.impl.DAOTestCase.setUpTransactionManager(DAOTestCase.java:39)
at com.example.dao.impl.DAOTestCase.setUp(DAOTestCase.java:29)
at com.example.dao.impl.AccountDAOImplTest.setUp(AccountDAOImplTest.java:24)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.hibernate.MappingException: invalid mapping
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:672)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:520)
... 22 more
Caused by: org.xml.sax.SAXParseException: Element type "hibernate-mapping" must be declared.
at org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1196)
at org.apache.xerces.validators.common.XMLValidator.reportRecoverableXMLError(XMLValidator.java:1737)
at org.apache.xerces.validators.common.XMLValidator.validateElementAndAttributes(XMLValidator.java:3552)
at org.apache.xerces.validators.common.XMLValidator.callStartElement(XMLValidator.java:1159)
at org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XMLDocumentScanner.java:938)
at org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner.java:381)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1081)
at org.dom4j.io.SAXReader.read(SAXReader.java:465)
at org.hibernate.cfg.AnnotationConfiguration.addInputStream(AnnotationConfiguration.java:668)
Name and version of the database you are using: HSQLDB 1.8.0