I'm using a shell script to drive maven and it has 4 runs of maven using the hibernate3 tools plugin; hibernate3:hbm2java, hibernate3:hbm2hbmxml, hibernate3:hbm2cfgxml, and hibernate3:hbm2ddl. It seems that I've done something bad to my mappings, because I'm getting the following error, but there isn't anything in the error messages (that I can see) that says which mapping is causing the problem. I'm using annotations. Is there some way I can turn up the logging or something so that I can figure out what mapping is causing the problem?
======================================
error trace from maven:
======================================
+ mvn -e -Pwss-test1-postgres -Dmaven.test.skip=true hibernate3:hbm2hbmxml
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building WMF waitlist db
[INFO] task-segment: [hibernate3:hbm2hbmxml]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing hibernate3:hbm2hbmxml
[INFO] No goals needed for project - skipping
[INFO] [hibernate3:hbm2hbmxml]
[INFO] using annotationconfiguration task.
[INFO] Configuration XML file loaded: file:/home/rusty/java/waitlist01/waitlist-db/src/main/hbm/hibernate.cfg_postgres.xml
2009-05-30 12:51:42.445 PDT, INFO: org.hibernate.cfg.annotations.Version.<clinit>.15: Hibernate Annotations 3.3.0.GA
2009-05-30 12:51:42.482 PDT, INFO: org.hibernate.cfg.Environment.<clinit>.514: Hibernate 3.2.5
2009-05-30 12:51:42.489 PDT, INFO: org.hibernate.cfg.Environment.<clinit>.547: hibernate.properties not found
2009-05-30 12:51:42.492 PDT, INFO: org.hibernate.cfg.Environment.buildBytecodeProvider.681: Bytecode provider name : cglib
2009-05-30 12:51:42.499 PDT, INFO: org.hibernate.cfg.Environment.<clinit>.598: using JDK 1.4 java.sql.Timestamp handling
[INFO] Configuration XML file loaded: file:/home/rusty/java/waitlist01/waitlist-db/src/main/hbm/hibernate.cfg_postgres.xml
2009-05-30 12:51:42.592 PDT, INFO: org.hibernate.cfg.Configuration.configure.1441: configuring from url: file:/home/rusty/java/waitlist01/waitlist-db/src/main/hbm/hibernate.cfg_postgres.xml
2009-05-30 12:51:42.701 PDT, INFO: org.hibernate.cfg.Configuration.doConfigure.1541: Configured SessionFactory: null
[INFO] src/main/resources/database.properties not found within the project. Trying absolute path.
[INFO] No hibernate properties file loaded.
2009-05-30 12:51:42.836 PDT, INFO: org.hibernate.cfg.AnnotationBinder.bindClass.398: Binding entity from annotated class: edu.berkeley.ist.waitlist.db.hbm.dto.Admin
2009-05-30 12:51:42.892 PDT, INFO: org.hibernate.cfg.annotations.EntityBinder.bindTable.420: Bind entity edu.berkeley.ist.waitlist.db.hbm.dto.Admin on table admins
2009-05-30 12:51:42.965 PDT, INFO: org.hibernate.cfg.AnnotationBinder.bindClass.398: Binding entity from annotated class: edu.berkeley.ist.waitlist.db.hbm.dto.Facility
2009-05-30 12:51:42.966 PDT, INFO: org.hibernate.cfg.annotations.EntityBinder.bindTable.420: Bind entity edu.berkeley.ist.waitlist.db.hbm.dto.Facility on table facilities
2009-05-30 12:51:43.035 PDT, INFO: org.hibernate.cfg.AnnotationBinder.bindClass.398: Binding entity from annotated class: edu.berkeley.ist.waitlist.db.hbm.dto.Platform
2009-05-30 12:51:43.036 PDT, INFO: org.hibernate.cfg.annotations.EntityBinder.bindTable.420: Bind entity edu.berkeley.ist.waitlist.db.hbm.dto.Platform on table platforms
2009-05-30 12:51:43.043 PDT, INFO: org.hibernate.cfg.AnnotationBinder.bindClass.398: Binding entity from annotated class: edu.berkeley.ist.waitlist.db.hbm.dto.State
2009-05-30 12:51:43.045 PDT, INFO: org.hibernate.cfg.annotations.EntityBinder.bindTable.420: Bind entity edu.berkeley.ist.waitlist.db.hbm.dto.State on table states
2009-05-30 12:51:43.054 PDT, INFO: org.hibernate.cfg.AnnotationBinder.bindClass.398: Binding entity from annotated class: edu.berkeley.ist.waitlist.db.hbm.dto.User
2009-05-30 12:51:43.055 PDT, INFO: org.hibernate.cfg.annotations.EntityBinder.bindTable.420: Bind entity edu.berkeley.ist.waitlist.db.hbm.dto.User on table users
2009-05-30 12:51:43.090 PDT, INFO: org.hibernate.cfg.AnnotationBinder.bindClass.398: Binding entity from annotated class: edu.berkeley.ist.waitlist.db.hbm.dto.Host
2009-05-30 12:51:43.091 PDT, INFO: org.hibernate.cfg.annotations.EntityBinder.bindTable.420: Bind entity edu.berkeley.ist.waitlist.db.hbm.dto.Host on table hosts
2009-05-30 12:51:43.107 PDT, INFO: org.hibernate.cfg.AnnotationBinder.bindClass.398: Binding entity from annotated class: edu.berkeley.ist.waitlist.db.hbm.dto.WaitlistEntry
2009-05-30 12:51:43.108 PDT, INFO: org.hibernate.cfg.annotations.EntityBinder.bindTable.420: Bind entity edu.berkeley.ist.waitlist.db.hbm.dto.WaitlistEntry on table waitlist_entries
2009-05-30 12:51:43.120 PDT, INFO: org.hibernate.cfg.AnnotationBinder.bindClass.398: Binding entity from annotated class: edu.berkeley.ist.waitlist.db.hbm.dto.WaitlistEnabled
2009-05-30 12:51:43.122 PDT, INFO: org.hibernate.cfg.annotations.EntityBinder.bindTable.420: Bind entity edu.berkeley.ist.waitlist.db.hbm.dto.WaitlistEnabled on table waitlist_enabled
2009-05-30 12:51:43.233 PDT, INFO: org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass.627: Mapping collection: edu.berkeley.ist.waitlist.db.hbm.dto.Facility.hosts -> hosts
2009-05-30 12:51:43.235 PDT, INFO: org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass.627: Mapping collection: edu.berkeley.ist.waitlist.db.hbm.dto.Facility.waitlistEnabled -> waitlist_enabled
2009-05-30 12:51:43.236 PDT, INFO: org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass.627: Mapping collection: edu.berkeley.ist.waitlist.db.hbm.dto.Facility.waitlistEntries -> waitlist_entries
2009-05-30 12:51:43.237 PDT, INFO: org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass.627: Mapping collection: edu.berkeley.ist.waitlist.db.hbm.dto.Platform.hosts -> hosts
2009-05-30 12:51:43.238 PDT, INFO: org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass.627: Mapping collection: edu.berkeley.ist.waitlist.db.hbm.dto.Platform.waitlistEntries -> waitlist_entries
2009-05-30 12:51:43.239 PDT, INFO: org.hibernate.cfg.annotations.CollectionBinder.bindOneToManySecondPass.627: Mapping collection: edu.berkeley.ist.waitlist.db.hbm.dto.User.waitlistEntries -> waitlist_entries
12:51:44,160 ERROR freemarker.runtime -
Expression property.getValue().getElement().getReferencedEntityName is undefined on line 24, column 41 in hbm/set.hbm.ftl.
The problematic instruction:
----------
==> ${property.getValue().getElement().getReferencedEntityName()} [on line 24, column 39 in hbm/set.hbm.ftl]
in include "${c2h.getTag(property)}.hbm.ftl" [on line 93, column 1 in hbm/persistentclass.hbm.ftl]
in include "persistentclass.hbm.ftl" [on line 34, column 1 in hbm/hibernate-mapping.hbm.ftl]
----------
Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: Expression property.getValue().getElement().getReferencedEntityName is undefined on line 24, column 41 in hbm/set.hbm.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:114)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:251)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:146)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:135)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:41)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:126)
at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMappingExporter.java:34)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:268)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:140)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
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)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error while processing template hbm/hibernate-mapping.hbm.ftl
Expression property.getValue().getElement().getReferencedEntityName is undefined on line 24, column 41 in hbm/set.hbm.ftl.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.hibernate.tool.hbm2x.ExporterException: Error while processing template hbm/hibernate-mapping.hbm.ftl
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:257)
at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:146)
at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:135)
at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.java:41)
at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:126)
at org.hibernate.tool.hbm2x.HibernateMappingExporter.doStart(HibernateMappingExporter.java:34)
at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:268)
at org.codehaus.mojo.hibernate3.HibernateExporterMojo.execute(HibernateExporterMojo.java:140)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:332)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:356)
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)
Caused by: freemarker.core.InvalidReferenceException: Expression property.getValue().getElement().getReferencedEntityName is undefined on line 24, column 41 in hbm/set.hbm.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:114)
at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
at freemarker.core.Expression.getStringValue(Expression.java:93)
at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IfBlock.accept(IfBlock.java:82)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
at freemarker.core.Environment.visit(Environment.java:351)
at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.include(Environment.java:1375)
at freemarker.core.Include.accept(Include.java:155)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.MixedContent.accept(MixedContent.java:92)
at freemarker.core.Environment.visit(Environment.java:196)
at freemarker.core.Environment.process(Environment.java:176)
at freemarker.template.Template.process(Template.java:232)
at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:251)
... 29 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Sat May 30 12:51:44 PDT 2009
[INFO] Final Memory: 11M/526M
[INFO] ------------------------------------------------------------------------
======================================
hibernate.cfg_postgres.xml:
======================================
Code:
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">
org.postgresql.Driver
</property>
<property name="connection.url">
jdbc:postgresql://server.berkeley.edu/waitlist
</property>
<property name="connection.username">
username
</property>
<property name="connection.password">
password
</property>
<!-- SQL dialect -->
<property name="dialect">
org.hibernate.dialect.PostgreSQLDialect
</property>
<property name="show_sql">
true
</property>
<property name="default_schema">
waitlist2
</property>
<!--
doesn't work with hbm2ddl for some reason.
-->
<!--
<mapping
package="edu.berkeley.ist.waitlist.db.hbm.dto"
/>
-->
<mapping
class="edu.berkeley.ist.waitlist.db.hbm.dto.Admin"
/>
<mapping
class="edu.berkeley.ist.waitlist.db.hbm.dto.Facility"
/>
<mapping
class="edu.berkeley.ist.waitlist.db.hbm.dto.Platform"
/>
<mapping
class="edu.berkeley.ist.waitlist.db.hbm.dto.State"
/>
<mapping
class="edu.berkeley.ist.waitlist.db.hbm.dto.User"
/>
<mapping
class="edu.berkeley.ist.waitlist.db.hbm.dto.Host"
/>
<mapping
class="edu.berkeley.ist.waitlist.db.hbm.dto.WaitlistEntry"
/>
<mapping
class="edu.berkeley.ist.waitlist.db.hbm.dto.WaitlistEnabled"
/>
</session-factory>
</hibernate-configuration>
======================================
plugin section from pom:
======================================
Code:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<!-- output goes to target/hibernate3 -->
<components>
<component>
<name>hbm2java</name>
<implementation>
jdbcconfiguration
</implementation>
</component>
<component>
<name>hbm2hbmxml</name>
<implementation>
annotationconfiguration
</implementation>
</component>
<component>
<name>hbm2cfgxml</name>
<implementation>
annotationconfiguration
</implementation>
</component>
<component>
<name>hbm2doc</name>
<implementation>
annotationconfiguration
</implementation>
</component>
<component>
<name>hbm2ddl</name>
<implementation>
annotationconfiguration
</implementation>
</component>
</components>
<componentProperties>
<configurationfile>
src/main/hbm/hibernate.cfg_${db2.flavor}.xml
</configurationfile>
<format>true</format>
<!-- hbm2java -->
<jdk5>true</jdk5>
<!-- hbm2java, hbm2cfgxml -->
<ejb3>true</ejb3>
<!-- hbm2ddl -->
<export>true</export>
<update>false</update>
<drop>true</drop>
<create>true</create>
<format>true</format>
<outputfilename>ddl.sql</outputfilename>
<haltonerror>true</haltonerror>
</componentProperties>
</configuration>
</plugin>