appfuse2.0.2 + Sql Server2005 mvn appfuse:gen-model 时报错 解决后报其他错误

 错误信息如下:

D:/>cd mysvn

D:/mysvn>cd KuuyoTest1

D:/mysvn/KuuyoTest1>mvn appfuse:gen-model
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'appfuse'.
[INFO] ------------------------------------------------------------------------
[INFO] Building AppFuse Struts 2 Application
[INFO]    task-segment: [appfuse:gen-model]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing appfuse:gen-model
Downloading: http://repo1.maven.org/maven2/jtds/jtds/1.2.2/jtds-1.2.2.pom
Downloading: http://static.appfuse.org/repository/jtds/jtds/1.2.2/jtds-1.2.2.pom
[INFO] [warpath:add-classes {execution: default}]
[INFO] [aspectj:compile {execution: default}]
[INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}]
[INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [appfuse:gen-model]
[INFO] Configuration XML file loaded: file:/D:/mysvn/KuuyoTest1/src/main/resources/hibernate.cfg.xml
[INFO] Configuration Properties file loaded: D:/mysvn/KuuyoTest1/target/classes/jdbc.properties
[INFO] Copying generated 'UserCookie.java' to project...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 28 seconds
[INFO] Finished at: Thu Apr 09 14:13:35 CST 2009
[INFO] Final Memory: 20M/37M
[INFO] ------------------------------------------------------------------------

D:/mysvn/KuuyoTest1>mvn appfuse:gen-model
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'appfuse'.
[INFO] ------------------------------------------------------------------------
[INFO] Building AppFuse Struts 2 Application
[INFO]    task-segment: [appfuse:gen-model]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing appfuse:gen-model
Downloading: http://repo1.maven.org/maven2/jtds/jtds/1.2.2/jtds-1.2.2.pom
Downloading: http://static.appfuse.org/repository/jtds/jtds/1.2.2/jtds-1.2.2.pom
[INFO] [warpath:add-classes {execution: default}]
[INFO] [aspectj:compile {execution: default}]
[INFO] [native2ascii:native2ascii {execution: native2ascii-utf8}]
[INFO] [native2ascii:native2ascii {execution: native2ascii-8859_1}]
[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] [appfuse:gen-model]
[INFO] Configuration XML file loaded: file:/D:/mysvn/KuuyoTest1/src/main/resources/hibernate.cfg.xml
[INFO] Configuration Properties file loaded: D:/mysvn/KuuyoTest1/target/classes/jdbc.properties
14:15:07,031 ERROR freemarker.runtime -
Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotation(org.hibernate.mapping.Property,org.hibernat
e.cfg.Configuration) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(com.kuuyo.app.model.WsoftCategoryOrder)
The problematic instruction:
----------
==> ${pojo.generateJoinColumnsAnnotation(property)} [on line 11, column 15 in appfuse/model/Ejb3PropertyGetAnnotation.ftl]
 in include "Ejb3PropertyGetAnnotation.ftl" [on line 1, column 1 in appfuse/model/GetPropertyAnnotation.ftl]
 in include "GetPropertyAnnotation.ftl" [on line 9, column 5 in appfuse/model/PojoPropertyAccessors.ftl]
 in include "PojoPropertyAccessors.ftl" [on line 9, column 1 in appfuse/model/Pojo.ftl]
----------

Java backtrace for programmers:
----------
freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumnsAnnotation
(org.hibernate.mapping.Property,org.hibernate.cfg.Configuration) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJOClass(com.
kuuyo.app.model.WsoftCategoryOrder)
        at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
        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(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.AbstractExporter.start(AbstractExporter.java:95)
        at org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:228)
        at org.appfuse.mojo.exporter.ModelGeneratorMojo.execute(ModelGeneratorMojo.java:183)
        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)
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(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
        at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
        ... 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 appfuse/model/Pojo.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.AbstractExporter.start(AbstractExporter.java:95)
        at org.appfuse.mojo.HibernateExporterMojo.doExecute(HibernateExporterMojo.java:228)
        at org.appfuse.mojo.exporter.ModelGeneratorMojo.execute(ModelGeneratorMojo.java:183)
        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)
Caused by: freemarker.template.TemplateModelException: Method public java.lang.String org.hibernate.tool.hbm2x.pojo.EntityPOJOClass.generateJoinColumn
sAnnotation(org.hibernate.mapping.Property,org.hibernate.cfg.Configuration) threw an exception when invoked on org.hibernate.tool.hbm2x.pojo.EntityPOJ
OClass(com.kuuyo.app.model.WsoftCategoryOrder)
        at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:136)
        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(TemplateHelper.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(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:616)
        at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:113)
        ... 74 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32 seconds
[INFO] Finished at: Thu Apr 09 14:15:07 CST 2009
[INFO] Final Memory: 22M/39M
[INFO] ------------------------------------------------------------------------

D:/mysvn/KuuyoTest1>

 

解决方法:----------------------------- 参考老外的帖子: http://www.nabble.com/appfuse-2.0.2-gen-model-and-join-columns--to20349030s2369.html#a20349030 ### 首先到项目下执行D:/mysvn/KuuyoTest1>mvn appfuse:copy-templates(我的项目) ### 然后在D:/mysvn/KuuyoTest1/src/test/resources/appfuse/model 目录下找到 Ejb3PropertyGetAnnotation.ftl文件,修改 <#if ejb3><#rt/> <#if pojo.hasIdentifierProperty()><#rt/> <#if property.equals(clazz.identifierProperty)><#rt/> <#lt/>${pojo.generateAnnIdGenerator()} @GeneratedValue(strategy = GenerationType.AUTO)<#rt/> <#rt/> <#rt/> <#if c2h.isManyToOne(property)><#rt/> <#--TODO support @OneToOne true and false--> <#lt/>${pojo.generateManyToOneAnnotation(property)} <#--TODO support optional and targetEntity--> <#lt/>${pojo.generateJoinColumnsAnnotation(property,cfg)}(注:这里加",cfg") <#elseif c2h.isCollection(property)><#rt/> <#lt/>${pojo.generateCollectionAnnotation(property, cfg)} <#else><#rt/> <#lt/>${pojo.generateBasicAnnotation(property)} <#if !property.equals(clazz.identifierProperty)><#rt/> <#lt/>${pojo.generateAnnColumnAnnotation(property)} <#rt/> <#rt/> <#rt/>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随与博主沟通,博主会及解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随与博主沟通,博主会及解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随与博主沟通,博主会及解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随与博主沟通,博主会及解答。
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随与博主沟通,博主会及解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随与博主沟通,博主会及解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随与博主沟通,博主会及解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随与博主沟通,博主会及解答。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值