Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

maven hbm2ddl goal - no JDBC connection

 
J. Cartwright
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I'm trying to work through the "Harnessing Hibernate" book using maven instead of ant. I'm only on chapter 2, but and getting an error trying to construct the DDL using the hbm2ddl goal:

java.lang.UnsupportedOperationException: The user must supply a JDBC connection at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30)

I don't understand this since I have the JDBC connection info specified in database.properties (and in hibernate.cfg.xml and hibernate.properties) all of which are located in src/main/resources.

Can someone help me out with what the problem might be? (Complete stack trace below)

Thanks!

--john


jaguar:ch02 jcc$ mvn hibernate3:hbm2ddl
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'hibernate3'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Harnessing Hibernate: Chapter Two: Mapping
[INFO] task-segment: [hibernate3:hbm2ddl]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing hibernate3:hbm2ddl
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [hibernate3:hbm2ddl]
[INFO] src/hibernate.cfg.xml not found within the project. Trying absolute path.
[INFO] Configuration XML file loaded: file:/Users/jcc/Desktop/HarnessingHibernate/ch02/target/classes/hibernate.cfg.xml
22:59:08,002 INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.2.0.GA
22:59:08,012 INFO org.hibernate.cfg.Environment - Hibernate 3.2.0.cr5
22:59:08,018 INFO org.hibernate.cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.connection.username=sa, hibernate.connection.password=****, hibernate.dialect=org.hibernate.dialect.HSQLDialect, hibernate.connection.shutdown=true, hibernate.connection.url=jdbc:hsqldb ata/music, hibernate.jdbc.batch_size=0, hibernate.bytecode.use_reflection_optimizer=false, hibernate.connection.driver_class=org.hsqldb.jdbcDriver}
22:59:08,018 INFO org.hibernate.cfg.Environment - Bytecode provider name : cglib
22:59:08,021 INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[INFO] src/hibernate.cfg.xml not found within the project. Trying absolute path.
[INFO] Configuration XML file loaded: file:/Users/jcc/Desktop/HarnessingHibernate/ch02/target/classes/hibernate.cfg.xml
22:59:08,065 INFO org.hibernate.cfg.Configuration - configuring from url: file:/Users/jcc/Desktop/HarnessingHibernate/ch02/target/classes/hibernate.cfg.xml
22:59:08,146 INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
[INFO] Configuration Properties file loaded: /Users/jcc/Desktop/HarnessingHibernate/ch02/src/main/resources/database.properties
22:59:08,191 INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.HSQLDialect
22:59:08,230 INFO org.hibernate.tool.hbm2ddl.SchemaExport - Running hbm2ddl schema export
22:59:08,231 INFO org.hibernate.tool.hbm2ddl.SchemaExport - exporting generated schema to database
22:59:08,233 WARN org.hibernate.connection.UserSuppliedConnectionProvider - No connection properties specified - the user must supply JDBC connections
22:59:08,233 ERROR org.hibernate.tool.hbm2ddl.SchemaExport - schema export unsuccessful
java.lang.UnsupportedOperationException: The user must supply a JDBC connection
at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30)
at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
at org.codehaus.mojo.hibernate3.exporter.Hbm2DDLExporterMojo.doExecute(Hbm2DDLExporterMojo.java:116)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:140)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:512)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:482)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
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:585)
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)
[WARNING] 1 errors occurred while performing <hbm2ddl>.
[ERROR] Error #1: java.lang.UnsupportedOperationException: The user must supply a JDBC connection
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Sat Oct 25 22:59:08 MDT 2008
[INFO] Final Memory: 4M/9M
[INFO] ------------------------------------------------------------------------
[ October 25, 2008: Message edited by: J. Cartwright ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic