Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 2.0-M5
-
Fix Version/s: 2.0-RC1
-
Component/s: Persistence Layer
-
Labels:None
Description
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
]
[INFO] [native2ascii:native2ascii
]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [hibernate3:hbm2ddl
]
[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:$
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:$
----------
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>
AFAICT, this is a bug in the full-source plugin. Do you agree? It doesn't include hibernate.version in your pom.xml when it should be.