|
|
|
stelios
|
Hi,
I've created a new Spring MVC Basic project. Changed the DB in the pom.xml to an existing one mvn compile,executes ok mvn appfuse:gen-model fails with following error: 10:43:33,984 ERROR freemarker.runtime - Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.gen erateJoinColumnsAnnotation(org.hibernate.mapping.Property,org.hibernate.cfg.Conf iguration) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.Enti tyPOJOClass(com.nubitek.vestia.model.HistoricoVarparam) The problematic instruction: ---------- ==> ${pojo.generateJoinColumnsAnnotation(property)} [on line 11, column 15 in ap pfuse/model/Ejb3PropertyGetAnnotation.ftl] in include "Ejb3PropertyGetAnnotation.ftl" [on line 1, column 1 in appfuse/mode l/GetPropertyAnnotation.ftl] in include "GetPropertyAnnotation.ftl" [on line 9, column 5 in appfuse/model/Po joPropertyAccessors.ftl] in include "PojoPropertyAccessors.ftl" [on line 9, column 1 in appfuse/model/Po jo.ftl] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateModelException: Method public java.lang.String org.h ibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotation(org.hiber nate.mapping.Property,org.hibernate.cfg.Configuration) threw an exception when i nvoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(com.nubitek.vestia.model .HistoricoVarparam) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:13 6) at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93) 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.ConditionalBlock.accept(ConditionalBlock.java:79) 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.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.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.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.visit(Environment.java:233) at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83) 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(TemplateHelpe r.java:251) at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro ducer.java:67) at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja va:28) at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja va:97) at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j ava:146) at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi cExporter.java:135) at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.ja va:41) at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java :126) at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java :95) at org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMoj o.java:228) at org.appfuse.mojo.exporter.ModelGeneratorMojo.execute(ModelGeneratorMo jo.java:183) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi nManager.java:451) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa ultLifecycleExecutor.java:558) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone Goal(DefaultLifecycleExecutor.java:512) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau ltLifecycleExecutor.java:482) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan dleFailures(DefaultLifecycleExecutor.java:330) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen ts(DefaultLifecycleExecutor.java:291) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi fecycleExecutor.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(DelegatingMethodAcces sorImpl.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) Caused by: java.lang.IllegalArgumentException: wrong number of arguments at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:11 3) ... 74 more [INFO] ------------------------------------------------------------------------ [ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error while processing template appfuse/model/Pojo.ftl wrong number of arguments [INFO] ------------------------------------------------------------------------ [INFO] Trace org.hibernate.tool.hbm2x.ExporterException: Error while processing template appf use/model/Pojo.ftl at org.hibernate.tool.hbm2x.TemplateHelper.processTemplate(TemplateHelpe r.java:257) at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro ducer.java:67) at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja va:28) at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja va:97) at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j ava:146) at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi cExporter.java:135) at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.ja va:41) at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java :126) at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java :95) at org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMoj o.java:228) at org.appfuse.mojo.exporter.ModelGeneratorMojo.execute(ModelGeneratorMo jo.java:183) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi nManager.java:451) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa ultLifecycleExecutor.java:558) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone Goal(DefaultLifecycleExecutor.java:512) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau ltLifecycleExecutor.java:482) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan dleFailures(DefaultLifecycleExecutor.java:330) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen ts(DefaultLifecycleExecutor.java:291) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi fecycleExecutor.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(DelegatingMethodAcces sorImpl.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) Caused by: freemarker.template.TemplateModelException: Method public java.lang.S tring org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotatio n(org.hibernate.mapping.Property,org.hibernate.cfg.Configuration) threw an excep tion when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(com.nubitek.v estia.model.HistoricoVarparam) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:13 6) at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93) 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.ConditionalBlock.accept(ConditionalBlock.java:79) 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.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.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.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.visit(Environment.java:233) at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83) 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(TemplateHelpe r.java:251) ... 28 more Caused by: java.lang.IllegalArgumentException: wrong number of arguments at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:11 3) ... 74 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 6 seconds [INFO] Finished at: Wed Jun 18 10:43:34 CEST 2008 [INFO] Final Memory: 19M/34M [INFO] ------------------------------------------------------------------------ I wonder where does this apply: Caused by: java.lang.IllegalArgumentException: wrong number of arguments Now if I create a new Spring MVC basic projec, add to the db appfuse creates new tables and then run mvn appfuse:gen-model the POJOs generated fine. The HistoricoVarparam table should not be the problem since excluding that does nothing more but to give the same error in the next table it tries to generate code from. Appfuse Version: 2.0.2 Maven: 2.0.9 I am using the default hibernate.reveng.xml any ideas? I´ve read everything I could find on similar issues and still haven't found a solution, probably something obvious I'm missing? Could it be the database it self? Although the tables I add to the appfuse db are taken from the same script... thanks stelios |
|||||||||||||||
|
stelios
|
well apparently the problem is the joined columns. The tables that fail are those which have relationships defined.
Is there any known issue with that?
|
|||||||||||||||
|
stelios
|
finally I got it working with Hibernate tools.
I had some configuration errors. Probably thats why appfuse:gen-model didn't work. POJOs are generated fine now;)
|
|||||||||||||||
|
Bob Fleischman
|
I am having this problem trying to reverse engineer a MySQL db with foreign keys. How did you get this working?
|
|||||||||||||||
|
stelios
|
I don't remember exactly to be honest...I'll try and have a look tomorrow at work.
|
|||||||||||||||
|
jamp1
|
In reply to this post
by stelios
I am having same kind of issue
below is the stack trace can you provide details on the fix. 09:54:03,747 ERROR freemarker.runtime - Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.gen erateJoinColumnsAnnotation(org.hibernate.mapping.Property,org.hibernate.cfg.Conf iguration) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.Enti tyPOJOClass(com.mycompany.app.model.ClaimDetail) The problematic instruction: ---------- ==> ${pojo.generateJoinColumnsAnnotation(property)} [on line 11, column 15 in ap pfuse/model/Ejb3PropertyGetAnnotation.ftl] in include "Ejb3PropertyGetAnnotation.ftl" [on line 1, column 1 in appfuse/mode l/GetPropertyAnnotation.ftl] in include "GetPropertyAnnotation.ftl" [on line 9, column 5 in appfuse/model/Po joPropertyAccessors.ftl] in include "PojoPropertyAccessors.ftl" [on line 9, column 1 in appfuse/model/Po jo.ftl] ---------- Java backtrace for programmers: ---------- freemarker.template.TemplateModelException: Method public java.lang.String org.h ibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotation(org.hiber nate.mapping.Property,org.hibernate.cfg.Configuration) threw an exception when i nvoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(com.mycompany.app.model. ClaimDetail) at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:13 6) at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93) 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.ConditionalBlock.accept(ConditionalBlock.java:79) 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.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.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.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.visit(Environment.java:233) at freemarker.core.BlockAssignment.accept(BlockAssignment.java:83) 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(TemplateHelpe r.java:251) at org.hibernate.tool.hbm2x.TemplateProducer.produceToString(TemplatePro ducer.java:67) at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja va:28) at org.hibernate.tool.hbm2x.TemplateProducer.produce(TemplateProducer.ja va:97) at org.hibernate.tool.hbm2x.GenericExporter.exportPOJO(GenericExporter.j ava:146) at org.hibernate.tool.hbm2x.GenericExporter.exportPersistentClass(Generi cExporter.java:135) at org.hibernate.tool.hbm2x.GenericExporter$2.process(GenericExporter.ja va:41) at org.hibernate.tool.hbm2x.GenericExporter.doStart(GenericExporter.java :126) at org.hibernate.tool.hbm2x.AbstractExporter.start(AbstractExporter.java :95) at org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMoj o.java:228) at org.appfuse.mojo.exporter.ModelGeneratorMojo.execute(ModelGeneratorMo jo.java:183) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi nManager.java:453) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa ultLifecycleExecutor.java:559) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandalone Goal(DefaultLifecycleExecutor.java:513) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau ltLifecycleExecutor.java:483 |
|||||||||||||||
|
mraible
|
Do you have any one-to-many or many-to-many relationships in your POJO. If so, comment them out and try again.
On Wed, Jun 3, 2009 at 11:09 AM, jamp1 <[hidden email]> wrote:
|
||||||||||||||||
|
jamp1
|
HI Matt,
thank you for your quick response i dont have any pojo's i am trying to use "mvn appfuse:gen-model" it is trying to connect to my postgres database and i do have my tables defined with foreign key relation's properly (that means i guess one-to-many and many-to-many). but here pojo's are created by "mvn appfuse:gen-model" i guess using Hibernate Tools. not sure if i need to do any other thing before to run 'mvn appfuse:gen-model" or some bug in "mvn appfuse:gen-model" code base. FYI i am able to generate (pojo's,dao's,.hbm's) using "Hibernate tools"
|
|||||||||||||||
|
mraible
|
Here's the file that's causing the error:
http://source.appfuse.org/browse/appfuse/trunk/plugins/appfuse-maven-plugin/src/main/resources/appfuse/model/Ejb3PropertyGetAnnotation.ftl?r=trunk It looks like join columns hasn't been implemented in the version of Hibernate Tools we're using. Unfortunately, I don't have a solution for you ATM. Matt On Wed, Jun 3, 2009 at 11:39 AM, jamp1 <[hidden email]> wrote:
|
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |