javax.persistence.PersistenceException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Please close issue APF-784. This issue replaces it. I really wanted to reopen issue APF-712. Anyways here are the steps to reproduce this issue with 2.0-m5 Summary: 1. create basic Spring MVC project. 2. change project to use jpa-hibernate 4. change project to include full source 4. mvn jetty:run-war Detailed steps: 1. mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject 2. cd myproject 3. follow steps found here http://appfuse.org/display/APF/Using+JPA for enabling JPA. A. Change the <dao.framework> property in your pom.xml to be jpa-hibernate instead of hibernate. B. Modify the configuration for the Hibernate3 Maven Plugin: change <implementation>annotationconfiguration</implementation> to <implementation>jpaconfiguration</implementation> in your pom.xml. C. DON't delete hibernate.cfg.xml upon recommendation that I need to keep it around to have things autogenerated. 4. mvn appfuse:full-source 5. mvn jetty:run-war During step 5 I see this: [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] Preparing hibernate3:hbm2ddl [WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive invocation. [INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}] [INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}] [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [hibernate3:hbm2ddl {execution: default}] [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] No name provided and several persistence units found [INFO] ------------------------------------------------------------------------ [INFO] Trace javax.persistence.PersistenceException: No name provided and several persistence units found at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:226) at org.codehaus.mojo.hibernate3.configuration.JPAComponentConfiguration.createConfiguration(JPAComponentConfiguration.java:26) at org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentConfiguration.java:32) at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:87) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:139) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:896) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:739) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:510) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) at org.apache.maven.cli.MavenCli.main(MavenCli.java:272) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9 seconds [INFO] Finished at: Wed May 30 09:54:14 ADT 2007 [INFO] Final Memory: 13M/24M [INFO] ------------------------------------------------------------------------ NOTE: the first time you run mvn jetty:run-war you see this Downloading: http://static.appfuse.org/repository/org/hibernate/hibernate-entitymanager/${hibernate.version}/hibernate-entitymanager-${hibernate.version}.jar [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) org.hibernate:hibernate-entitymanager:jar:${hibernate.version} Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate-entitymanager \ -Dversion=${hibernate.version} -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) com.mycompany.app:myproject:war:1.0-SNAPSHOT 2) org.hibernate:hibernate-entitymanager:jar:${hibernate.version} ---------- 1 required artifact is missing. for artifact: com.mycompany.app:myproject:war:1.0-SNAPSHOT I worked around that by adding in the pom.xml properties section the following <hibernate.version>3.2.1.ga</hibernate.version>
    via by Peter Lynch,
  • Please close issue APF-784. This issue replaces it. I really wanted to reopen issue APF-712. Anyways here are the steps to reproduce this issue with 2.0-m5 Summary: 1. create basic Spring MVC project. 2. change project to use jpa-hibernate 4. change project to include full source 4. mvn jetty:run-war Detailed steps: 1. mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/repository -DarchetypeVersion=2.0-m5 -DgroupId=com.mycompany.app -DartifactId=myproject 2. cd myproject 3. follow steps found here http://appfuse.org/display/APF/Using+JPA for enabling JPA. A. Change the <dao.framework> property in your pom.xml to be jpa-hibernate instead of hibernate. B. Modify the configuration for the Hibernate3 Maven Plugin: change <implementation>annotationconfiguration</implementation> to <implementation>jpaconfiguration</implementation> in your pom.xml. C. DON't delete hibernate.cfg.xml upon recommendation that I need to keep it around to have things autogenerated. 4. mvn appfuse:full-source 5. mvn jetty:run-war During step 5 I see this: [INFO] [compiler:compile] [INFO] Nothing to compile - all classes are up to date [INFO] [resources:testResources] [INFO] Using default encoding to copy filtered resources. [INFO] Preparing hibernate3:hbm2ddl [WARNING] Removing: hbm2ddl from forked lifecycle, to prevent recursive invocation. [INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}] [INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}] [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [hibernate3:hbm2ddl {execution: default}] [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] No name provided and several persistence units found [INFO] ------------------------------------------------------------------------ [INFO] Trace javax.persistence.PersistenceException: No name provided and several persistence units found at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:226) at org.codehaus.mojo.hibernate3.configuration.JPAComponentConfiguration.createConfiguration(JPAComponentConfiguration.java:26) at org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentConfiguration.java:32) at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:87) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:139) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:896) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:739) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:510) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) at org.apache.maven.cli.MavenCli.main(MavenCli.java:272) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) [INFO] ------------------------------------------------------------------------ [INFO] Total time: 9 seconds [INFO] Finished at: Wed May 30 09:54:14 ADT 2007 [INFO] Final Memory: 13M/24M [INFO] ------------------------------------------------------------------------ NOTE: the first time you run mvn jetty:run-war you see this Downloading: http://static.appfuse.org/repository/org/hibernate/hibernate-entitymanager/${hibernate.version}/hibernate-entitymanager-${hibernate.version}.jar [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) org.hibernate:hibernate-entitymanager:jar:${hibernate.version} Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=org.hibernate -DartifactId=hibernate-entitymanager \ -Dversion=${hibernate.version} -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) com.mycompany.app:myproject:war:1.0-SNAPSHOT 2) org.hibernate:hibernate-entitymanager:jar:${hibernate.version} ---------- 1 required artifact is missing. for artifact: com.mycompany.app:myproject:war:1.0-SNAPSHOT I worked around that by adding in the pom.xml properties section the following <hibernate.version>3.2.1.ga</hibernate.version>
    via by Peter Lynch,
  • I'm working on APF-565 (allowing dao.framework switching) and experiencing an issue with the hibernate3 plugin. Here's how I'm excluding Hibernate and including JPA in my sample project: <dependency> <groupId>org.appfuse</groupId> <artifactId>appfuse-${web.framework}</artifactId> <version>${appfuse.version}</version> <type>warpath</type> <exclusions> <exclusion> <groupId>org.appfuse</groupId> <artifactId>appfuse-hibernate</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.appfuse</groupId> <artifactId>appfuse-${dao.framework}</artifactId> <version>${appfuse.version}</version> </dependency> Here's the error I'm getting: [INFO] ------------------------------------------------------------------------ [INFO] No name provided and several persistence units found [INFO] ------------------------------------------------------------------------ [INFO] Trace javax.persistence.PersistenceException: No name provided and several persistence units found at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:226) at org.codehaus.mojo.hibernate3.configuration.JPAComponentConfiguration.createConfiguration( JPAComponentConfiguration.java:26) at org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguratio n(AbstractComponentConfiguration.java:32) at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.j ava:87) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:139 In pom.xml, I have: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.0-alpha-1</version> <configuration> <components> <component> <name>hbm2ddl</name> <implementation>jpaconfiguration</implementation> </component> </components> <componentProperties> <drop>true</drop> <jdk5>true</jdk5> <propertyfile>target/classes/jdbc.properties</propertyfile> <skip>${maven.test.skip}</skip> </componentProperties> </configuration> <executions> <execution> <phase>process-test-resources</phase> <goals> <goal>hbm2ddl</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> </dependencies> </plugin>
    via by Matt Raible,
  • I'm working on APF-565 (allowing dao.framework switching) and experiencing an issue with the hibernate3 plugin. Here's how I'm excluding Hibernate and including JPA in my sample project: <dependency> <groupId>org.appfuse</groupId> <artifactId>appfuse-${web.framework}</artifactId> <version>${appfuse.version}</version> <type>warpath</type> <exclusions> <exclusion> <groupId>org.appfuse</groupId> <artifactId>appfuse-hibernate</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.appfuse</groupId> <artifactId>appfuse-${dao.framework}</artifactId> <version>${appfuse.version}</version> </dependency> Here's the error I'm getting: [INFO] ------------------------------------------------------------------------ [INFO] No name provided and several persistence units found [INFO] ------------------------------------------------------------------------ [INFO] Trace javax.persistence.PersistenceException: No name provided and several persistence units found at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:226) at org.codehaus.mojo.hibernate3.configuration.JPAComponentConfiguration.createConfiguration( JPAComponentConfiguration.java:26) at org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguratio n(AbstractComponentConfiguration.java:32) at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.j ava:87) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:139 In pom.xml, I have: <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>hibernate3-maven-plugin</artifactId> <version>2.0-alpha-1</version> <configuration> <components> <component> <name>hbm2ddl</name> <implementation>jpaconfiguration</implementation> </component> </components> <componentProperties> <drop>true</drop> <jdk5>true</jdk5> <propertyfile>target/classes/jdbc.properties</propertyfile> <skip>${maven.test.skip}</skip> </componentProperties> </configuration> <executions> <execution> <phase>process-test-resources</phase> <goals> <goal>hbm2ddl</goal> </goals> </execution> </executions> <dependencies> <dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> </dependency> </dependencies> </plugin>
    via by Matt Raible,
  • Criando entidades através do JPA Tools
    via by Flávio Nóbrega,
  • Hibernate Archives • my2cents
    via by Unknown author,
    • javax.persistence.PersistenceException: No name provided and several persistence units found at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:226) at org.codehaus.mojo.hibernate3.configuration.JPAComponentConfiguration.createConfiguration(JPAComponentConfiguration.java:26) at org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentConfiguration.java:32) at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:87) at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:139) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:896) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:739) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:510) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125) at org.apache.maven.cli.MavenCli.main(MavenCli.java:272) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

    Users with the same issue

    Unknown visitor1 times, last one,