javax.persistence.PersistenceException: No name provided and several persistence units found

AppFuse JIRA | Peter Lynch | 10 years ago
  1. 0

    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>

    AppFuse JIRA | 10 years ago | Peter Lynch
    javax.persistence.PersistenceException: No name provided and several persistence units found
  2. 0

    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>

    AppFuse JIRA | 10 years ago | Peter Lynch
    javax.persistence.PersistenceException: No name provided and several persistence units found
  3. 0

    Taylor / Discussion / Help:Error on running mvn eclipse:eclipse

    sourceforge.net | 1 year ago
    javax.persistence.PersistenceException: [PersistenceUnit: tutorial1] Unable to c onfigure EntityManagerFactory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    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>

    AppFuse JIRA | 10 years ago | Matt Raible
    javax.persistence.PersistenceException: No name provided and several persistence units found
  6. 0

    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>

    AppFuse JIRA | 10 years ago | Matt Raible
    javax.persistence.PersistenceException: No name provided and several persistence units found

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.persistence.PersistenceException

      No name provided and several persistence units found

      at org.hibernate.ejb.Ejb3Configuration.configure()
    2. Hibernate EJB
      Ejb3Configuration.configure
      1. org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:226)
      1 frame
    3. org.codehaus.mojo
      HibernateExporterMojo.execute
      1. org.codehaus.mojo.hibernate3.configuration.JPAComponentConfiguration.createConfiguration(JPAComponentConfiguration.java:26)
      2. org.codehaus.mojo.hibernate3.configuration.AbstractComponentConfiguration.getConfiguration(AbstractComponentConfiguration.java:32)
      3. org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:87)
      4. org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:139)
      4 frames
    4. Maven Plugin
      DefaultPluginManager.executeMojo
      1. org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
      1 frame
    5. Maven Core
      DefaultMaven.execute
      1. org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
      2. org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:480)
      3. org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkProjectLifecycle(DefaultLifecycleExecutor.java:896)
      4. org.apache.maven.lifecycle.DefaultLifecycleExecutor.forkLifecycle(DefaultLifecycleExecutor.java:739)
      5. org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:510)
      6. org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
      7. org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
      8. org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
      9. org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
      10. org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
      11. org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
      12. org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
      12 frames
    6. M3 Interceptor
      MavenCli.main
      1. org.apache.maven.cli.MavenCli.main(MavenCli.java:272)
      1 frame
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:597)
      4 frames
    8. Plexus
      Launcher.main
      1. org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      2. org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      3. org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      4. org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      4 frames