Freemarker error 4

Source: Internet
Author: User

1. Error description

May 28 9:56:48 freemarker. log. JDK14LoggerFactory $ JDK14Logger error: Template processing error: "Expression student. course is undefined on line 15, column 24 in course. ftl. "Expression student. course is undefined on line 15, column 24 in course. ftl. the problematic instruction: ---------- ==>$ {student. course} [on line 15, column 22 in course. ftl] ---------- Java backtrace for programmers: ---------- freemarker. core. invalidReferenceException: Expression student. course is undefined on line 15, column 24 in course. ftl. at freemarker. core. templateObject. assertNonNull (TemplateObject. java: 125) at freemarker. core. expression. getStringValue (Expression. java: 118) at freemarker. core. expression. getStringValue (Expression. java: 93) at freemarker. core. dollarVariable. accept (DollarVariable. java: 76) at freemarker. core. environment. visit (Environment. java: 221) at freemarker. core. mixedContent. accept (MixedContent. java: 92) at freemarker. core. environment. visit (Environment. java: 221) at freemarker. core. environment. process (Environment. java: 199) at freemarker. template. template. process (Template. java: 259) at com. you. freemarker. freemarkerTemplate. printFtl (FreemarkerTemplate. java: 77) at com. you. test. freemarker. freemarkerTest. studentPrint (FreemarkerTest. java: 141) at com. you. test. freemarker. freemarkerTest. testCourse (FreemarkerTest. java: 128) at sun. reflect. nativeMethodAccessorImpl. invoke0 (Native Method) at sun. reflect. nativeMethodAccessorImpl. invoke (Unknown Source) at sun. reflect. delegatingMethodAccessorImpl. invoke (Unknown Source) at java. lang. reflect. method. invoke (Unknown Source) at org. junit. runners. model. frameworkMethod $1. runReflectiveCall (FrameworkMethod. java: 45) at org. junit. internal. runners. model. reflectiveCallable. run (ReflectiveCallable. java: 15) at org. junit. runners. model. frameworkMethod. invokeExplosively (FrameworkMethod. java: 42) at org. junit. internal. runners. statements. invokeMethod. evaluate (InvokeMethod. java: 20) at org. junit. internal. runners. statements. runBefores. evaluate (RunBefores. java: 28) at org. junit. runners. parentRunner. runLeaf (ParentRunner. java: 263) at org. junit. runners. blockJUnit4ClassRunner. runChild (BlockJUnit4ClassRunner. java: 68) at org. junit. runners. blockJUnit4ClassRunner. runChild (BlockJUnit4ClassRunner. java: 47) at org. junit. runners. parentRunner $ 3.run( ParentRunner. java: 231) at org. junit. runners. parentRunner $1. schedule (ParentRunner. java: 60) at org. junit. runners. parentRunner. runChildren (ParentRunner. java: 229) at org. junit. runners. parentRunner. access $000 (ParentRunner. java: 50) at org. junit. runners. parentRunner $2. evaluate (ParentRunner. java: 222) at org. junit. runners. parentRunner. run (ParentRunner. java: 300) at org. eclipse. jdt. internal. junit4.runner. JUnit4TestReference. run (JUnit4TestReference. java: 50) at org. eclipse. jdt. internal. junit. runner. testExecution. run (TestExecution. java: 38) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. runTests (RemoteTestRunner. java: 467) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. runTests (RemoteTestRunner. java: 683) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. run (RemoteTestRunner. java: 390) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. main (RemoteTestRunner. java: 197) Expression student. course is undefined on line 15, column 24 in course. ftl. the problematic instruction: ---------- ==>$ {student. course} [on line 15, column 22 in course. ftl] ---------- Java backtrace for programmers: ---------- freemarker. core. invalidReferenceException: Expression student. course is undefined on line 15, column 24 in course. ftl. at freemarker. core. templateObject. assertNonNull (TemplateObject. java: 125) at freemarker. core. expression. getStringValue (Expression. java: 118) at freemarker. core. expression. getStringValue (Expression. java: 93) at freemarker. core. dollarVariable. accept (DollarVariable. java: 76) at freemarker. core. environment. visit (Environment. java: 221) at freemarker. core. mixedContent. accept (MixedContent. java: 92) at freemarker. core. environment. visit (Environment. java: 221) at freemarker. core. environment. process (Environment. java: 199) at freemarker. template. template. process (Template. java: 259) at com. you. freemarker. freemarkerTemplate. printFtl (FreemarkerTemplate. java: 77) at com. you. test. freemarker. freemarkerTest. studentPrint (FreemarkerTest. java: 141) at com. you. test. freemarker. freemarkerTest. testCourse (FreemarkerTest. java: 128) at sun. reflect. nativeMethodAccessorImpl. invoke0 (Native Method) at sun. reflect. nativeMethodAccessorImpl. invoke (Unknown Source) at sun. reflect. delegatingMethodAccessorImpl. invoke (Unknown Source) at java. lang. reflect. method. invoke (Unknown Source) at org. junit. runners. model. frameworkMethod $1. runReflectiveCall (FrameworkMethod. java: 45) at org. junit. internal. runners. model. reflectiveCallable. run (ReflectiveCallable. java: 15) at org. junit. runners. model. frameworkMethod. invokeExplosively (FrameworkMethod. java: 42) at org. junit. internal. runners. statements. invokeMethod. evaluate (InvokeMethod. java: 20) at org. junit. internal. runners. statements. runBefores. evaluate (RunBefores. java: 28) at org. junit. runners. parentRunner. runLeaf (ParentRunner. java: 263) at org. junit. runners. blockJUnit4ClassRunner. runChild (BlockJUnit4ClassRunner. java: 68) at org. junit. runners. blockJUnit4ClassRunner. runChild (BlockJUnit4ClassRunner. java: 47) at org. junit. runners. parentRunner $ 3.run( ParentRunner. java: 231) at org. junit. runners. parentRunner $1. schedule (ParentRunner. java: 60) at org. junit. runners. parentRunner. runChildren (ParentRunner. java: 229) at org. junit. runners. parentRunner. access $000 (ParentRunner. java: 50) at org. junit. runners. parentRunner $2. evaluate (ParentRunner. java: 222) at org. junit. runners. parentRunner. run (ParentRunner. java: 300) at org. eclipse. jdt. internal. junit4.runner. JUnit4TestReference. run (JUnit4TestReference. java: 50) at org. eclipse. jdt. internal. junit. runner. testExecution. run (TestExecution. java: 38) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. runTests (RemoteTestRunner. java: 467) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. runTests (RemoteTestRunner. java: 683) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. run (RemoteTestRunner. java: 390) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. main (RemoteTestRunner. java: 197)      
     Student Information      Name: Zhang Sanfeng Gender: male age: 16 birthdays: Address: QQ: 78,451,214 Course: Expression student, Hongshan district, Wuchang City, Hubei Province. course is undefined on line 15, column 24 in course. ftl. the problematic instruction: ---------- ==>$ {student. course} [on line 15, column 22 in course. ftl] ---------- Java backtrace for programmers: ---------- freemarker. core. invalidReferenceException: Expression student. course is undefined on line 15, column 24 in course. ftl. at freemarker. core. templateObject. assertNonNull (TemplateObject. java: 125) at freemarker. core. expression. getStringValue (Expression. java: 118) at freemarker. core. expression. getStringValue (Expression. java: 93) at freemarker. core. dollarVariable. accept (DollarVariable. java: 76) at freemarker. core. environment. visit (Environment. java: 221) at freemarker. core. mixedContent. accept (MixedContent. java: 92) at freemarker. core. environment. visit (Environment. java: 221) at freemarker. core. environment. process (Environment. java: 199) at freemarker. template. template. process (Template. java: 259) at com. you. freemarker. freemarkerTemplate. printFtl (FreemarkerTemplate. java: 77) at com. you. test. freemarker. freemarkerTest. studentPrint (FreemarkerTest. java: 141) at com. you. test. freemarker. freemarkerTest. testCourse (FreemarkerTest. java: 128) at sun. reflect. nativeMethodAccessorImpl. invoke0 (Native Method) at sun. reflect. nativeMethodAccessorImpl. invoke (Unknown Source) at sun. reflect. delegatingMethodAccessorImpl. invoke (Unknown Source) at java. lang. reflect. method. invoke (Unknown Source) at org. junit. runners. model. frameworkMethod $1. runReflectiveCall (FrameworkMethod. java: 45) at org. junit. internal. runners. model. reflectiveCallable. run (ReflectiveCallable. java: 15) at org. junit. runners. model. frameworkMethod. invokeExplosively (FrameworkMethod. java: 42) at org. junit. internal. runners. statements. invokeMethod. evaluate (InvokeMethod. java: 20) at org. junit. internal. runners. statements. runBefores. evaluate (RunBefores. java: 28) at org. junit. runners. parentRunner. runLeaf (ParentRunner. java: 263) at org. junit. runners. blockJUnit4ClassRunner. runChild (BlockJUnit4ClassRunner. java: 68) at org. junit. runners. blockJUnit4ClassRunner. runChild (BlockJUnit4ClassRunner. java: 47) at org. junit. runners. parentRunner $ 3.run( ParentRunner. java: 231) at org. junit. runners. parentRunner $1. schedule (ParentRunner. java: 60) at org. junit. runners. parentRunner. runChildren (ParentRunner. java: 229) at org. junit. runners. parentRunner. access $000 (ParentRunner. java: 50) at org. junit. runners. parentRunner $2. evaluate (ParentRunner. java: 222) at org. junit. runners. parentRunner. run (ParentRunner. java: 300) at org. eclipse. jdt. internal. junit4.runner. JUnit4TestReference. run (JUnit4TestReference. java: 50) at org. eclipse. jdt. internal. junit. runner. testExecution. run (TestExecution. java: 38) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. runTests (RemoteTestRunner. java: 467) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. runTests (RemoteTestRunner. java: 683) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. run (RemoteTestRunner. java: 390) at org. eclipse. jdt. internal. junit. runner. remoteTestRunner. main (RemoteTestRunner. java: 197)

2. Error cause

The course attribute in the Student class is not assigned a value, and the freemarker returns an error for the attribute that is null.

Course: $ {student. course}

3. Solution

Add "!" after the property value

Course: $ {student. course !}


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.