Hi. I've got 73 hbm.xml files that describe persistent entities in an application that has been deployed to JBoss 4.2.2 for many years. I'm attempting to port to JBoss 7.1.1 with whatever version of Hibernate is included. The hbm.xml files used to be in the jar file that contained the classes that implemented the model. Hibernate read the files when the ear was loaded. This no longer happens. I've read that most people put their persistence.xml file in a separate jar to be packaged in the ear's lib directory. I've followed suit. hbm.xml files were still not being read by Hibernate, and I couldn't figure out how to tell Hibernate where they were, so I tried moving the hbm.xml files to the jar file that contains the persistence.xml. Now the hbm.xml files are being read, but references to other classes from within the hbm.xml files are failing:
10:49:36,084 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.persistenceunit."appEar.ear#app": org.jboss.msc.service.StartException in service jboss.persistenceunit."appEar.ear#app": Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) [classes.jar:1.6.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) [classes.jar:1.6.0_51] at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_51] Caused by: javax.persistence.PersistenceException: [PersistenceUnit: app] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] ... 3 more Caused by: org.hibernate.MappingException: Association references unmapped class: com.app.session.common.Note at org.hibernate.cfg.HbmBinder.bindCollectionSecondPass(HbmBinder.java:2453) at org.hibernate.cfg.HbmBinder$CollectionSecondPass.secondPass(HbmBinder.java:2730) at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66) at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1586) at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1359) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1724) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) ... 9 more
Am I going about this the right way? Do I need to establish a classpath for the jar that contains persistence.xml that allows the com.app.session.common classes to be resolved?
Thanks for any advice.
Richard
|