2017-02-27 90 views
1

我用Spring Tool Suite 3.8.3創建了一個使用Spring Roo 2 M3的非常簡單的工作項目。它只是列出了一個MySQL表的內容,並允許我編輯它。我不能讓節目,除非我在下面的代碼推手動校正它:爲什麼我必須糾正春天的代碼?

package org.oclc.web; 
import org.oclc.domain.SFDCRecordTypeAccount; 
import org.springframework.roo.addon.web.mvc.controller.annotations.ControllerType; 
import org.springframework.roo.addon.web.mvc.controller.annotations.RooController; 
import org.springframework.roo.addon.web.mvc.thymeleaf.annotations.RooThymeleaf; 
import org.springframework.ui.Model; 
import org.springframework.web.bind.annotation.GetMapping; 
import org.springframework.web.bind.annotation.ModelAttribute; 
import org.springframework.web.servlet.ModelAndView; 

/** 
* = SFDCRecordTypeAccountsItemThymeleafController 
* 
* TODO Auto-generated class documentation 
* 
*/ 
@RooController(entity = SFDCRecordTypeAccount.class, type = ControllerType.ITEM) 
@RooThymeleaf 
public class SFDCRecordTypeAccountsItemThymeleafController { 

/** 
* TODO Auto-generated method documentation 
* 
* @param sFDCRecordTypeAccount 
* @param model 
* @return ModelAndView 
*/ 
@GetMapping(name = "show") 
public ModelAndView show(@ModelAttribute SFDCRecordTypeAccount sFDCRecordTypeAccount, Model model) { 
    ModelAndView model1 = new ModelAndView("sfdcrecordtypeaccounts/show"); 
    model1.addObject("sFDCRecordTypeAccount",sFDCRecordTypeAccount); 
    return (model1); 
} 

}

難道我做錯了什麼,當我生成的原始代碼?下面是我log.roo文件的內容:

// Spring Roo 2.0.0.M3 [rev 20a0f71] log opened at 2017-03-02 16:39:23 
project setup --topLevelPackage org.oclc --projectName "eadIntegration11" --java 8 --packaging JAR 
// Spring Roo 2.0.0.M3 [rev 20a0f71] log closed at 2017-03-02 16:39:24 
// Spring Roo 2.0.0.M3 [rev 20a0f71] log opened at 2017-03-02 16:39:27 
jpa setup --provider HIBERNATE --database MYSQL 
entity jpa --class ~.domain.SFDCRecordTypeAccount --table sfdc_record_type_account --identifierColumn sfdc_record_type_account_id --identifierStrategy AUTO --sequenceName sequenceName --identifierType java.lang.Integer 
field string --fieldName sfdcRecordTypeId --column sfdc_record_type_id 
field string --fieldName siebelRecordTypeId --column siebel_record_type_id 
// [failed] field string --fieldName sfdcRecordTypeId 
repository jpa --all 
finder add --entity ~.domain.SFDCRecordTypeAccount --name findById 
service --all 
web mvc setup 
web mvc view setup --type THYMELEAF 
web mvc templates setup --type THYMELEAF 
web mvc controller --entity ~.domain.SFDCRecordTypeAccount --responseType THYMELEAF 
web mvc finder --all --responseType THYMELEAF 
exit 
// Spring Roo 2.0.0.M3 [rev 20a0f71] log closed at 2017-03-02 17:05:22 

這裏是日誌中的錯誤:

2017-03-02 17:01:30.501 ERROR 11956 --- [nio-8080-exec-4] org.thymeleaf.TemplateEngine    : [THYMELEAF][http-nio-8080-exec-4] Exception processing template "sfdcrecordtypeaccounts/show": An error happened during template parsing (template: "class path resource [templates/sfdcrecordtypeaccounts/show.html]") 

org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/sfdcrecordtypeaccounts/show.html]") 
    at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:241) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parseStandalone(AbstractMarkupTemplateParser.java:100) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:667) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1087) [thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1061) [thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.spring4.view.ThymeleafView.renderFragment(ThymeleafView.java:335) [thymeleaf-spring4-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.spring4.view.ThymeleafView.render(ThymeleafView.java:189) [thymeleaf-spring4-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1257) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1037) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:980) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.springframework.web.servlet.resource.ResourceUrlEncodingFilter.doFilterInternal(ResourceUrlEncodingFilter.java:53) [spring-webmvc-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_121] 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_121] 
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.5.jar:8.5.5] 
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121] 
Caused by: org.attoparser.ParseException: Exception evaluating SpringEL expression: "sfdcRecordTypeId" (template: "sfdcrecordtypeaccounts/show" - line 168, col 27) 
    at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:393) ~[attoparser-2.0.0.RELEASE.jar:2.0.0.RELEASE] 
    at org.attoparser.MarkupParser.parse(MarkupParser.java:257) ~[attoparser-2.0.0.RELEASE.jar:2.0.0.RELEASE] 
    at org.thymeleaf.templateparser.markup.AbstractMarkupTemplateParser.parse(AbstractMarkupTemplateParser.java:230) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    ... 56 common frames omitted 
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "sfdcRecordTypeId" (template: "sfdcrecordtypeaccounts/show" - line 168, col 27) 
    at org.thymeleaf.spring4.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:290) ~[thymeleaf-spring4-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.standard.expression.SelectionVariableExpression.executeSelectionVariableExpression(SelectionVariableExpression.java:157) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.standard.expression.SimpleExpression.executeSimple(SimpleExpression.java:90) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.standard.expression.Expression.execute(Expression.java:109) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.standard.expression.Expression.execute(Expression.java:138) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.standard.expression.Expression.execute(Expression.java:125) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.standard.processor.AbstractStandardExpressionAttributeTagProcessor.doProcess(AbstractStandardExpressionAttributeTagProcessor.java:82) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1304) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1567) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.Model.process(Model.java:290) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.GatheringModelProcessable.process(GatheringModelProcessable.java:78) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleCloseElement(ProcessorTemplateHandler.java:1620) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.CloseElementTag.beHandled(CloseElementTag.java:139) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1567) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.Model.process(Model.java:282) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.Model.process(Model.java:290) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.GatheringModelProcessable.process(GatheringModelProcessable.java:78) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.ProcessorTemplateHandler.handleCloseElement(ProcessorTemplateHandler.java:1620) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.engine.TemplateHandlerAdapterMarkupHandler.handleCloseElementEnd(TemplateHandlerAdapterMarkupHandler.java:388) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler$InlineMarkupAdapterPreProcessorHandler.handleCloseElementEnd(InlinedOutputExpressionMarkupHandler.java:322) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.standard.inline.OutputExpressionInlinePreProcessorHandler.handleCloseElementEnd(OutputExpressionInlinePreProcessorHandler.java:220) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.thymeleaf.templateparser.markup.InlinedOutputExpressionMarkupHandler.handleCloseElementEnd(InlinedOutputExpressionMarkupHandler.java:164) ~[thymeleaf-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    at org.attoparser.HtmlElement.handleCloseElementEnd(HtmlElement.java:169) ~[attoparser-2.0.0.RELEASE.jar:2.0.0.RELEASE] 
    at org.attoparser.HtmlMarkupHandler.handleCloseElementEnd(HtmlMarkupHandler.java:412) ~[attoparser-2.0.0.RELEASE.jar:2.0.0.RELEASE] 
    at org.attoparser.MarkupEventProcessorHandler.handleCloseElementEnd(MarkupEventProcessorHandler.java:473) ~[attoparser-2.0.0.RELEASE.jar:2.0.0.RELEASE] 
    at org.attoparser.ParsingElementMarkupUtil.parseCloseElement(ParsingElementMarkupUtil.java:201) ~[attoparser-2.0.0.RELEASE.jar:2.0.0.RELEASE] 
    at org.attoparser.MarkupParser.parseBuffer(MarkupParser.java:725) ~[attoparser-2.0.0.RELEASE.jar:2.0.0.RELEASE] 
    at org.attoparser.MarkupParser.parseDocument(MarkupParser.java:301) ~[attoparser-2.0.0.RELEASE.jar:2.0.0.RELEASE] 
    ... 58 common frames omitted 
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Property or field 'sfdcRecordTypeId' cannot be found on object of type 'java.lang.Integer' - maybe not public? 
    at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:224) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:81) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:330) ~[spring-expression-4.3.3.RELEASE.jar:4.3.3.RELEASE] 
    at org.thymeleaf.spring4.expression.SPELVariableExpressionEvaluator.evaluate(SPELVariableExpressionEvaluator.java:277) ~[thymeleaf-spring4-3.0.0.RELEASE.jar:3.0.0.RELEASE] 
    ... 94 common frames omitted 
+0

您能否提供有關使用默認生成的代碼出現的問題的更多信息? – jcgarcia

+0

我無法爲您提供一個答案,但沒有出現您使用默認生成代碼出現的錯誤跟蹤......請提供該答案以嘗試查找解決方案。 – jcgarcia

+0

從默認生成的代碼中添加新的log.roo文件和堆棧跟蹤。 –

回答