10 Replies Latest reply on Feb 14, 2007 8:40 AM by Gavin King

    seam-gen error

    Peter Brewer Novice

      I've just started looking at seam-gen (with Seam 1.1.5 and Oracle XE) and it fails when running the generate-entites task. It manages to build all the entity beans, but breaks half way through building the xxxList.xhtml pages (it does output about 10 files of an expected 40).

      The error message is:

      ...
      [hibernate] 2. task: generic exportertemplate: view/list.xhtml.ftl
      07-Feb-2007 14:43:32 org.hibernate.connection.DriverManagerConnectionProvider close
      INFO: cleaning up connection pool: jdbc:oracle:thin:@localhost:1521:XE
      [hibernate] 07-Feb-2007 14:43:33 freemarker.log.JDK14LoggerFactory$JDK14Logger error
      [hibernate] SEVERE:
      
      [hibernate] Expression property.value.typeName is undefined on line 30, column 6 in view/list.xhtml.ftl.
      [hibernate] The problematic instruction:
      [hibernate] ----------
      [hibernate] ==> if property.value.typeName == "string" [on line 30, column 1 in view/list.xhtml.ftl]
      [hibernate] ----------
      
      [hibernate] Java backtrace for programmers:
      [hibernate] ----------
      [hibernate] freemarker.core.InvalidReferenceException: Expression property.value.typeName is undefined on line 30, column 6 in view/list.xhtml.ftl.
      [hibernate] at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
      [hibernate] at freemarker.core.ComparisonExpression.isTrue(ComparisonExpression.java:121)
      [hibernate] at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)
      [hibernate] at freemarker.core.Environment.visit(Environment.java:196)
      [hibernate] at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)
      [hibernate] at freemarker.core.Environment.visit(Environment.java:196)
      [hibernate] at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
      [hibernate] at freemarker.core.Environment.visit(Environment.java:351)
      [hibernate] at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
      [hibernate] at freemarker.core.Environment.visit(Environment.java:196)
      [hibernate] at freemarker.core.MixedContent.accept(MixedContent.java:92)
      [hibernate] at freemarker.core.Environment.visit(Environment.java:196)
      [hibernate] at freemarker.core.Environment.process(Environment.java:176)
      [hibernate] at freemarker.template.Template.process(Template.java:231)
      [hibernate] at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:247)
      [hibernate] at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplateProducer.java:67)
      [hibernate] at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:28)
      [hibernate] at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.java:97)
      [hibernate] at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.java:84)
      [hibernate] at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:73)
      [hibernate] at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:56)
      [hibernate] at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:41)
      [hibernate] at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
      [hibernate] at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
      [hibernate] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:182)
      [hibernate] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
      [hibernate] at org.apache.tools.ant.Task.perform(Task.java:364)
      [hibernate] at org.apache.tools.ant.Target.execute(Target.java:341)
      [hibernate] at org.apache.tools.ant.Target.performTasks(Target.java:369)
      [hibernate] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
      [hibernate] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
      [hibernate] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
      [hibernate] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
      [hibernate] at org.apache.tools.ant.Main.runBuild(Main.java:668)
      [hibernate] at org.apache.tools.ant.Main.startAnt(Main.java:187)
      [hibernate] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
      [hibernate] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
      [hibernate] An exception occurred while running exporter #3:generic exportertemplate: view/list.xhtml.ftl
      [hibernate] To get the full stack trace run ant with -verbose
      [hibernate] org.hibernate.tool.hbm2x.ExporterException: Error while processing template view/list.xhtml.ftl
      [hibernate] freemarker.core.InvalidReferenceException: Expression property.value.typeName is undefined on line 30, column 6 in view/list.xhtml.ftl.
      
      BUILD FAILED
      \jboss-seam-1.1.5.GA\seam-gen\build.xml:785: org.hibernate.tool.hbm2x.ExporterException: Error while processing template view/list.xhtml.ftl
       at org.hibernate.tool.ant.HibernateToolTask.reportException(HibernateToolTask.java:222)
       at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:185)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
       at org.apache.tools.ant.Task.perform(Task.java:364)
       at org.apache.tools.ant.Target.execute(Target.java:341)
       at org.apache.tools.ant.Target.performTasks(Target.java:369)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
       at org.apache.tools.ant.Main.runBuild(Main.java:668)
       at org.apache.tools.ant.Main.startAnt(Main.java:187)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
      Caused by: org.hibernate.tool.hbm2x.ExporterException: Error while processing template view/list.xhtml.ftl
       at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:253)
       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:84)
       at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:73)
       at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:56)
       at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:41)
       at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
       at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
       at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:182)
       ... 12 more
      Caused by: freemarker.core.InvalidReferenceException: Expression property.value.typeName is undefined on line 30, column 6 in view/list.xhtml.ftl.
       at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
       at freemarker.core.ComparisonExpression.isTrue(ComparisonExpression.java:121)
       at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)
       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.process(Environment.java:176)
       at freemarker.template.Template.process(Template.java:231)
       at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:247)
       ... 22 more
      --- Nested Exception ---
      org.hibernate.tool.hbm2x.ExporterException: Error while processing template view/list.xhtml.ftl
       at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:253)
       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:84)
       at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(GenericExporter.java:73)
       at org.hibernate.tool.hbm2x.GenericExporter.exportClasses(GenericExporter.java:56)
       at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java:41)
       at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java:95)
       at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:40)
       at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:182)
       at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
       at org.apache.tools.ant.Task.perform(Task.java:364)
       at org.apache.tools.ant.Target.execute(Target.java:341)
       at org.apache.tools.ant.Target.performTasks(Target.java:369)
       at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
       at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
       at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
       at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
       at org.apache.tools.ant.Main.runBuild(Main.java:668)
       at org.apache.tools.ant.Main.startAnt(Main.java:187)
       at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
       at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
      Caused by: freemarker.core.InvalidReferenceException: Expression property.value.typeName is undefined on line 30, column 6 in
       view/list.xhtml.ftl.
       at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
       at freemarker.core.ComparisonExpression.isTrue(ComparisonExpression.java:121)
       at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)
       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.process(Environment.java:176)
       at freemarker.template.Template.process(Template.java:231)
       at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelper.java:247)
       ... 22 more
      


      The part it's compaining about is in the for loop:
      <#foreach property in pojo.allPropertiesIterator>
      <#if !c2h.isCollection(property) && !c2h.isManyToOne(property)>
      <#if property.value.typeName == "string"><#-- IT BREAKS ON THIS LINE -->
       <tr class="prop">
       <td class="name">${property.name}</td>
       <td class="value">
       <h:inputText id="${property.name}"
       value="${'#'}{${listName}.${componentName}.${property.name}}"/>
       </td>
       </tr>
      </#if>
      </#if>
      </#foreach>
      


      I've tried changing the breaking line to the following, but freemarker complains about my syntax.
      <#if (property.value.typeName)?? && property.value.typeName == "string">
      


      Any ideas on why its throwing an exception or how to fix it would be greatly recieved.

      Thanks in advance, Pete

        • 1. Re: seam-gen error
          Gavin King Master

          Please try again with current CVS, thanks.

          • 2. Re: seam-gen error
            Peter Brewer Novice

            Thanks for the quick response.

            Unfortunately, I've just updated to the latest cvs (list.xhtml.ftl is now v1.11) and the problem is still present (with the same error as before). If there's anything else I can try let me know.

            Cheers, Pete.

            • 3. Re: seam-gen error
              Gavin King Master

              What schema is being reverse engineered, that causes the problem?

              Are you sure you really got my fix? Remember that anon cvs is behind...

              • 4. Re: seam-gen error
                Peter Brewer Novice

                The schema is called PBTEST and contains more than 40 tables and I've also set the default_schema property via Seam setup (to avoid generating against system tables).

                I've just tried it against 1.1.6.GA and generation still fails, with the same problem.

                Is there anyway I can tell seam-gen which specific tables to generate against to discover which table its failing on?

                • 5. Re: seam-gen error
                  Steve Harris Newbie

                  For what it's worth, I'm getting the same error (property.value.typeName is undefined, at the same line of view/list.xhtml.ftl), against Oracle 10.2.

                  I had warnings about my index organized tables above it and had assumed that was the problem, maybe not...

                  • 6. Re: seam-gen error
                    Steve Harris Newbie

                    It also appears to be schema-dependent - I just tried it with the same setup but a much simpler schema with only two tables and 6 fields, and didn't get the error...

                    • 7. Re: seam-gen error
                      Gavin King Master

                      Sorry, I forgot: this is the error that occurs when you have composite keys in your schema since seam-gen does not yet support this.

                      I'll take a look at implementing composite key support today. I keep forgetting about it.

                      • 8. Re: seam-gen error
                        Gavin King Master

                        This is now fixed in CVS.

                        • 9. Re: seam-gen error
                          Peter Brewer Novice

                          I can confirm that the current cvs fixes the issue I was encountering.

                          Unfortunately, now it gets a bit further and fails. Any ideas on this one?

                          Cheers, Pete.

                          The ant output is listed below:

                          ...
                          [hibernate] 14-Feb-2007 11:44:37 org.hibernate.tool.Version <clinit>
                          [hibernate] INFO: Hibernate Tools 3.2.0.b9
                          [hibernate] 2. task: generic exportertemplate: view/list.xhtml.ftl
                          14-Feb-2007 11:44:39 org.hibernate.connection.DriverManagerConnectionProvider close
                          INFO: cleaning up connection pool: jdbc:oracle:thin:@jspc:1521:XE
                          [hibernate] 3. task: generic exportertemplate: view/view.xhtml.ftl
                          [hibernate] 4. task: generic exportertemplate: view/view.page.xml.ftl
                          
                          BUILD FAILED
                          java.lang.StackOverflowError
                           at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1225)
                           at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
                           at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
                           at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
                           at org.apache.tools.ant.Main.runBuild(Main.java:668)
                           at org.apache.tools.ant.Main.startAnt(Main.java:187)
                           at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
                           at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
                          Caused by: java.lang.StackOverflowError
                           at java.lang.reflect.Method.hashCode(Method.java:370)
                           at java.util.HashMap.get(HashMap.java:300)
                           at freemarker.ext.beans.BeanModel.invokeThroughDescriptor(BeanModel.java:234)
                           at freemarker.ext.beans.BeanModel.get(BeanModel.java:177)
                           at freemarker.core.Dot._getAsTemplateModel(Dot.java:76)
                           at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
                           at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:86)
                           at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
                           at freemarker.core.Expression.isTrue(Expression.java:138)
                           at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:77)
                           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.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
                          ** stack repeats this section: **
                           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.ConditionalBlock.accept(ConditionalBlock.java:79)
                           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.ConditionalBlock.accept(ConditionalBlock.java:79)
                           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.IteratorBlock$Context.runLoop(IteratorBlock.java:160)
                          ** end of repeated section **
                           at freemarker.core.Environment.visit(Environment.java:351)
                           at freemarker.core.IteratorBlock.accept(IteratorBlock.java:95)
                           at freemarker.core.Environment.visit(Environment.java:196)
                          
                          Total time: 41 seconds
                          


                          • 10. Re: seam-gen error
                            Gavin King Master

                            Dunno, find out what piece of your schema makes it choke, and show us that bit of the schema.