Grails:2.4 Java:Oracle 1.7 操作系统:Ubuntu 14.04 你好朋友, 我正在开展一个示例项目,以提高我对grails的了解。对于控制器文件,当我用def替换def index(){}时 def scaffold = EventManagment,我得到一个错误,下面提到了日志。如果我不添加该行,并且我进入localhost页面,那么我看不到web-app的运行情况。请告诉我该怎么做。谢谢。 控制器文件是/grails-2.4.0/EventMg/grails-app/controllers/com/Evenmgmt.groovy。 记录:
| Running Grails application
| Error 2014-06-15 16:47:52,353 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'com.tekdays.TekEventController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.tekdays.TekEventController]: Constructor threw exception; nested exception is java.lang.NullPointerException
Message: Error creating bean with name 'com.tekdays.TekEventController': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.tekdays.TekEventController]: Constructor threw exception; nested exception is java.lang.NullPointerException
Line | Method
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanInstantiationException: Could not instantiate bean class [com.tekdays.TekEventController]: Constructor threw exception; nested exception is java.lang.NullPointerException
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by NullPointerException: null
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
| Error Forked Grails VM exited with error
答案 0 :(得分:1)
我能够通过彻底安装旧版本的Ubuntu解决问题。相同的代码工作。这个问题对我来说就是回答了。