-
1. Re: @PersistenceUnit not working
redmond007 Sep 29, 2011 5:14 PM (in response to redmond007)I was asked to see if I can reproduce this problem against JBoss nightly builds.
my code looks like
@PersistenceUnit(unitName="primary") private static EntityManagerFactory entityManagerFactory; EntityManager entityManager = entityManagerFactory.createEntityManager();
and my persistence.xml looks like
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="primary"> <!-- If you are running in a production environment, add a managed data source, the example data source is just for proofs of concept! --> <non-jta-data-source>java:jboss/datasources/MySqlDS</non-jta-data-source> <class>com.mycompany.myapp.common.persistence.BusinessObject</class> <class>com.mycompany.myapp.common.Address</class> <class>com.mycompany.myapp.common.businessobjects.Brand</class> <properties> <!-- Properties for Hibernate --> <!-- <sproperty name="hibernate.hbm2ddl.auto" value="create-drop" /> --> <!-- <property name="hibernate.show_sql" value="false" /> --> <!-- <property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/datasources/MySqlDS"/> --> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.ejb.interceptor.session_scoped" value="com.mycompany.myapp.common.persistence.BusinessObjectInterceptor"/> <!-- <property name="jboss.entity.manager.jndi.name" value="java:global/persistence/Manager1"/> --> <!-- <property name="jboss.entity.manager.factory.jndi.name" value="java:global/persistence/Manager1Factory"/> --> </properties> </persistence-unit> </persistence>
I get this error when I try to deploy this against jboss-as-7.1.0.Alpha2-SNAPSHOT
16:08:03,212 INFO [org.jboss.modules] JBoss Modules version 1.0.1.GA 16:08:06,203 INFO [org.jboss.msc] JBoss MSC version 1.0.1.GA 16:08:06,822 INFO [org.jboss.as] JBoss AS 7.1.0.Alpha2-SNAPSHOT "Ahoy!" starting 16:08:13,108 ERROR [stderr] Exception in thread "Controller Boot Thread" java.lang.RuntimeException: org.jboss.as.controller.persistence.ConfigurationPersistenceException: Failed to parse configuration 16:08:13,108 ERROR [stderr] at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:89) 16:08:13,109 ERROR [stderr] at java.lang.Thread.run(Thread.java:680) 16:08:13,109 ERROR [stderr] Caused by: org.jboss.as.controller.persistence.ConfigurationPersistenceException: Failed to parse configuration 16:08:13,109 ERROR [stderr] at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:125) 16:08:13,109 ERROR [stderr] at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:104) 16:08:13,109 ERROR [stderr] at org.jboss.as.server.ServerService.boot(ServerService.java:195) 16:08:13,110 ERROR [stderr] at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:83) 16:08:13,110 ERROR [stderr] ... 1 more 16:08:13,110 ERROR [stderr] Caused by: javax.xml.stream.XMLStreamException: org.jboss.as.connector.util.ParserException: IJ010061: Unexpected element: useFastFail 16:08:13,110 ERROR [stderr] at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$NewDataSourceSubsystemParser.readElement(DataSourcesExtension.java:687) 16:08:13,110 ERROR [stderr] at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$NewDataSourceSubsystemParser.readElement(DataSourcesExtension.java:273) 16:08:13,111 ERROR [stderr] at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:100) 16:08:13,111 ERROR [stderr] at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) 16:08:13,111 ERROR [stderr] at org.jboss.as.controller.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:327) 16:08:13,112 ERROR [stderr] at org.jboss.as.controller.parsing.StandaloneXml.readServerElement(StandaloneXml.java:183) 16:08:13,112 ERROR [stderr] at org.jboss.as.controller.parsing.StandaloneXml.readElement(StandaloneXml.java:98) 16:08:13,112 ERROR [stderr] at org.jboss.as.controller.parsing.StandaloneXml.readElement(StandaloneXml.java:80) 16:08:13,112 ERROR [stderr] at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:100) 16:08:13,113 ERROR [stderr] at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:59) 16:08:13,113 ERROR [stderr] at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:117) 16:08:13,113 ERROR [stderr] ... 4 more 16:08:13,114 ERROR [stderr] Caused by: org.jboss.as.connector.util.ParserException: IJ010061: Unexpected element: useFastFail 16:08:13,114 ERROR [stderr] at org.jboss.as.connector.subsystems.datasources.DsParser.parseValidationSetting(DsParser.java:991) 16:08:13,114 ERROR [stderr] at org.jboss.as.connector.subsystems.datasources.DsParser.parseDataSource(DsParser.java:664) 16:08:13,114 ERROR [stderr] at org.jboss.as.connector.subsystems.datasources.DsParser.parseDataSources(DsParser.java:189) 16:08:13,115 ERROR [stderr] at org.jboss.as.connector.subsystems.datasources.DsParser.parse(DsParser.java:160) 16:08:13,115 ERROR [stderr] at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$NewDataSourceSubsystemParser.readElement(DataSourcesExtension.java:679) 16:08:13,115 ERROR [stderr] ... 14 more
-
2. Re: @PersistenceUnit not working
smarlow Sep 29, 2011 9:04 PM (in response to redmond007)I suspect a typo in the datasource definition is cause the above ParserException.
-
3. Re: @PersistenceUnit not working
shelly.mcgowan Sep 29, 2011 9:30 PM (in response to redmond007)IronJacamar 1.0.3.Final integrated since AS 7.0.1.Final included a change for JBJCA-643:
This changed:
<useFastFail>false</useFastFail>
to
<use-fast-fail>false</use-fast-fail>
As Scott mentioned above, check your datasources subsystem configuration.
-
4. Re: @PersistenceUnit not working
redmond007 Sep 30, 2011 10:14 AM (in response to shelly.mcgowan)Thanks for your help. I tried it again, this time changing
<useFastFail>false</useFastFail>
to
<use-fast-fail>false</use-fast-fail>
in my datasource subsystem configuration in standalone.xml.
I get a different error this time upon deploy:
09:10:35,588 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-5) Hibernate Validator 4.2.0.Final 09:10:36,111 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.persistenceunit."myapp.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."myapp.war#primary": Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26] at java.lang.Thread.run(Thread.java:680) [:1.6.0_26] Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97) at org.dom4j.DocumentHelper.getDocumentFactory(DocumentHelper.java:36) at org.dom4j.DocumentHelper.createDocument(DocumentHelper.java:41) at org.hibernate.envers.configuration.RevisionInfoConfiguration.generateDefaultRevisionInfoXmlMapping(RevisionInfoConfiguration.java:86) at org.hibernate.envers.configuration.RevisionInfoConfiguration.configure(RevisionInfoConfiguration.java:322) at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:94) at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:134) at org.hibernate.envers.event.EnversIntegrator.integrate(EnversIntegrator.java:63) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1722) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:143) at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:77) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] ... 3 more ~
-
5. Re: @PersistenceUnit not working
redmond007 Oct 7, 2011 11:47 AM (in response to redmond007)I was asked to see if I can reproduce this problem against JBoss nightly builds from last night.
my code looks like
@PersistenceUnit(unitName="primary") private static EntityManagerFactory entityManagerFactory; EntityManager entityManager = entityManagerFactory.createEntityManager();
and my persistence.xml looks like
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="primary"> <!-- If you are running in a production environment, add a managed data source, the example data source is just for proofs of concept! --> <non-jta-data-source>java:jboss/datasources/MySqlDS</non-jta-data-source> <class>com.mycompany.myapp.common.persistence.BusinessObject</class> <class>com.mycompany.myapp.common.Address</class> <class>com.mycompany.myapp.common.businessobjects.Brand</class> <properties> <!-- Properties for Hibernate --> <!-- <sproperty name="hibernate.hbm2ddl.auto" value="create-drop" /> --> <!-- <property name="hibernate.show_sql" value="false" /> --> <!-- <property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/datasources/MySqlDS"/> --> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.ejb.interceptor.session_scoped" value="com.mycompany.myapp.common.persistence.BusinessObjectInterceptor"/> <!-- <property name="jboss.entity.manager.jndi.name" value="java:global/persistence/Manager1"/> --> <!-- <property name="jboss.entity.manager.factory.jndi.name" value="java:global/persistence/Manager1Factory"/> --> </properties> </persistence-unit> </persistence>
My standalone looks like
<use-fast-fail>false</use-fast-fail>
I get this error when I try to deploy this against jboss-as-7.1.0.Alpha2-SNAPSHOT
10:41:58,304 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.persistenceunit."myapp.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."myapp.war#primary": Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26] at java.lang.Thread.run(Thread.java:680) [:1.6.0_26] Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97) at org.dom4j.DocumentHelper.getDocumentFactory(DocumentHelper.java:36) at org.dom4j.DocumentHelper.createDocument(DocumentHelper.java:41) at org.hibernate.envers.configuration.RevisionInfoConfiguration.generateDefaultRevisionInfoXmlMapping(RevisionInfoConfiguration.java:86) at org.hibernate.envers.configuration.RevisionInfoConfiguration.configure(RevisionInfoConfiguration.java:322) at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:94) at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:134) at org.hibernate.envers.event.EnversIntegrator.integrate(EnversIntegrator.java:63) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1722) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:145) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:78) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
... 3 more
-
6. Re: @PersistenceUnit not working
smarlow Oct 7, 2011 11:59 AM (in response to redmond007)Similar issue here http://community.jboss.org/message/630480.
Try the suggestion here http://community.jboss.org/message/630478#630478
The solution is to remove dom4j from your application, and then add a
Dependencies: org.dom4j
to your MANIFEST.MF
This will make the application servers dom4j availble to your application. For more see details https://docs.jboss.org/author/display/AS7/Class+Loading+in+AS7
-
7. Re: @PersistenceUnit not working
stliu Oct 7, 2011 11:41 PM (in response to smarlow)instead of doing this Scott suggected, can you also try add this system property -Dorg.dom4j.DocumentFactory.singleton.strategy=org.dom4j.util.PerThreadSingleton
thanks
-
8. Re: @PersistenceUnit not working
redmond007 Oct 13, 2011 12:31 PM (in response to stliu)Strong - I tried your suggestion, and attempted to deploy against JBoss nightly builds from last night.
my code looks like
@PersistenceUnit(unitName="primary") private static EntityManagerFactory entityManagerFactory; EntityManager entityManager = entityManagerFactory.createEntityManager();
and my persistence.xml looks like
<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="primary"> <!-- If you are running in a production environment, add a managed data source, the example data source is just for proofs of concept! --> <non-jta-data-source>java:jboss/datasources/MySqlDS</non-jta-data-source> <class>com.mycompany.myapp.common.persistence.BusinessObject</class> <class>com.mycompany.myapp.common.Address</class> <class>com.mycompany.myapp.common.businessobjects.Brand</class> <properties> <!-- Properties for Hibernate --> <!-- <sproperty name="hibernate.hbm2ddl.auto" value="create-drop" /> --> <!-- <property name="hibernate.show_sql" value="false" /> --> <!-- <property name="jboss.entity.manager.factory.jndi.name" value="java:jboss/datasources/MySqlDS"/> --> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="hibernate.ejb.interceptor.session_scoped" value="com.mycompany.myapp.common.persistence.BusinessObjectInterceptor"/> <!-- <property name="jboss.entity.manager.jndi.name" value="java:global/persistence/Manager1"/> --> <!-- <property name="jboss.entity.manager.factory.jndi.name" value="java:global/persistence/Manager1Factory"/> --> </properties> </persistence-unit> </persistence>
My standalone looks like
<use-fast-fail>false</use-fast-fail>
I also added
Dependencies: org.dom4j
to MANIFEST.MF
I get this error when I try to deploy this against jboss-as-7.1.0.Alpha2-SNAPSHOT, looks like the same error
11:24:26,235 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-16) MSC00001: Failed to start service jboss.persistenceunit."myapp.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."myapp.war#primary": Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26] at java.lang.Thread.run(Thread.java:680) [:1.6.0_26] Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97) at org.dom4j.DocumentHelper.getDocumentFactory(DocumentHelper.java:36) at org.dom4j.DocumentHelper.createDocument(DocumentHelper.java:41) at org.hibernate.envers.configuration.RevisionInfoConfiguration.generateDefaultRevisionInfoXmlMapping(RevisionInfoConfiguration.java:86) at org.hibernate.envers.configuration.RevisionInfoConfiguration.configure(RevisionInfoConfiguration.java:322) at org.hibernate.envers.configuration.AuditConfiguration.<init>(AuditConfiguration.java:94) at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:134) at org.hibernate.envers.event.EnversIntegrator.integrate(EnversIntegrator.java:63) at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:294) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1722) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:76) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:150) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:78) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] ... 3 more
-
9. Re: @PersistenceUnit not working
stliu Oct 13, 2011 12:33 PM (in response to redmond007)I have fixed this in hibernate, today would be a release day but Steve decided postpone the release in 2 weeks, so you can check out hibernate source and give it a try, thanks
-
10. Re: @PersistenceUnit not working
stliu Oct 13, 2011 12:36 PM (in response to redmond007)or you can download hibernate nightly build from here http://ci.jboss.org/jenkins/job/hibernate-core-master/, and use hibernate-core.jar to replace the one in as7
-
11. Re: @PersistenceUnit not working
redmond007 Oct 13, 2011 1:12 PM (in response to stliu)Strong - Thank you for your help! So I'd have to wait two weeks for the next snapshot release to try this fix in as7? I tried downloading the hibernate nightly build - then copying lib/required/hibernate-core-4.0.0-SNAPSHOT.jar to <jboss home>/modules/org/hibernate/main, then changing the reference to the new jar in <jboss home>/modules/org/hibernate/main/module.xml.
I tried deploying my app but ran into another deployment error
12:06:55,915 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-13) MSC00001: Failed to start service jboss.persistenceunit."myapp.war#primary": org.jboss.msc.service.StartException in service jboss.persistenceunit."myapp.war#primary": Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26] at java.lang.Thread.run(Thread.java:680) [:1.6.0_26] Caused by: java.lang.NoSuchMethodError: org.hibernate.service.ServiceRegistryBuilder.<init>(Ljava/util/Map;)V at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:150) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:78) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA] ... 3 more
-
12. Re: @PersistenceUnit not working
stliu Oct 13, 2011 1:20 PM (in response to redmond007)also replace hibernate-entitymanager jar
-
13. Re: @PersistenceUnit not working
redmond007 Oct 13, 2011 1:37 PM (in response to stliu)I copied lib/jpa/hibernate-entitymanager-4.0.0-SNAPSHOT.jar into <jboss home>/modules/org/hibernate/main, then changed the reference to entitymanager jar in <jboss home>/modules/org/hibernate/main/module.xml. I get an error when attempting to deploy - perhaps I missed something
12:34:05,433 INFO [org.jboss.modules] JBoss Modules version 1.0.1.GA 12:34:06,295 INFO [org.jboss.msc] JBoss MSC version 1.0.1.GA 12:34:06,367 INFO [org.jboss.as] JBoss AS 7.1.0.Alpha2-SNAPSHOT "Ahoy!" starting 12:34:07,746 INFO [org.jboss.as] JBoss AS 7.1.0.Alpha2-SNAPSHOT "Ahoy!" stopped in 3ms 12:34:07,742 ERROR [org.jboss.as.controller.AbstractControllerService] Error booting the container: org.jboss.modules.ModuleLoadError: Error loading module from /opt/jboss-as-7.1.0.Alpha2-SNAPSHOT 3/modules/org/hibernate/main/module.xml at org.jboss.modules.ModuleLoadException.toError(ModuleLoadException.java:78) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.Module.getPaths(Module.java:1104) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.Module.getResources(Module.java:655) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleClassLoader.findResources(ModuleClassLoader.java:502) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ConcurrentClassLoader.getResources(ConcurrentClassLoader.java:196) [jboss-modules.jar:1.0.1.GA] at java.util.ServiceLoader$LazyIterator.hasNext(ServiceLoader.java:323) [:1.6.0_26] at java.util.ServiceLoader$1.hasNext(ServiceLoader.java:415) [:1.6.0_26] at org.jboss.as.controller.parsing.CommonXml.parseExtensions(CommonXml.java:326) [jboss-as-controller-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT] at org.jboss.as.controller.parsing.StandaloneXml.readServerElement_1_0(StandaloneXml.java:169) [jboss-as-controller-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT] at org.jboss.as.controller.parsing.StandaloneXml.readElement(StandaloneXml.java:99) [jboss-as-controller-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT] at org.jboss.as.controller.parsing.StandaloneXml.readElement(StandaloneXml.java:82) [jboss-as-controller-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT] at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:100) [staxmapper-1.0.0.Final.jar:1.0.0.Final] at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:59) [staxmapper-1.0.0.Final.jar:1.0.0.Final] at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:117) [jboss-as-controller-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT] at org.jboss.as.controller.AbstractControllerService.boot(AbstractControllerService.java:168) [jboss-as-controller-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT] at org.jboss.as.server.ServerService.boot(ServerService.java:195) [jboss-as-server-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT] at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:133) [jboss-as-controller-7.1.0.Alpha2-SNAPSHOT.jar:7.1.0.Alpha2-SNAPSHOT] at java.lang.Thread.run(Thread.java:680) [:1.6.0_26] Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[30,71] Message: Failed to add resource root 'hibernate-entitymanager-4.0.0-SNAPSHOT' at path 'hibernate-entitymanager-4.0.0-SNAPSHOT' at org.jboss.modules.ModuleXmlParser.parseResourceRoot(ModuleXmlParser.java:751) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleXmlParser.parseResources(ModuleXmlParser.java:707) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleXmlParser.parseModuleContents(ModuleXmlParser.java:575) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleXmlParser.parseDocument(ModuleXmlParser.java:505) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:244) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleXmlParser.parseModuleXml(ModuleXmlParser.java:200) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.LocalModuleLoader.parseModuleInfoFile(LocalModuleLoader.java:147) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.LocalModuleLoader.findModule(LocalModuleLoader.java:124) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleLoader.loadModuleLocal(ModuleLoader.java:245) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleLoader.preloadModule(ModuleLoader.java:194) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.LocalModuleLoader.preloadModule(LocalModuleLoader.java:97) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.ModuleLoader.loadModule(ModuleLoader.java:176) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.Module.linkImports(Module.java:1039) [jboss-modules.jar:1.0.1.GA] at org.jboss.modules.Module.getPaths(Module.java:1101) [jboss-modules.jar:1.0.1.GA] ... 16 more
-
14. Re: @PersistenceUnit not working
stliu Oct 13, 2011 1:40 PM (in response to redmond007)this is an xml parsing error, check your org/hibernate/main/module.xml
or paste it here