0

我刚刚升级到 Grails 2.0,我在 run-app 上看到了下面的错误。它表示 NPE 在一条简单的线上

return fileSpec;

我已经在互联网上搜索了一段时间,我发现有些人在使用各种插件时遇到了问题,但不是特别是这个 NPE 问题。使用组件扫描器加载我的 Spring bean 似乎是某种问题,但我很难理解为什么它不再工作了。在 Grails 1.3.7 -> 2.0 升级之前,它运行良好。

如果有任何 Grails 或 Spring 3.1 专家可以为我指出正确的方向,我将不胜感激。谢谢。

这是错误:

=============== DEBUG MESSAGE: unimplemented bytecode ================
| Error 2012-01-17 21:21:42,273 [Thread-10] ERROR context.GrailsContextLoader  - Error executing bootstraps: Error creating bean with name 'fileSpec': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public myproject.spec.FileSpec myproject.spec.MyFileSpecGenerator.createFileSpec()] threw exception; nested exception is java.lang.NullPointerException
Message: Error creating bean with name 'fileSpec': Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public myproject.spec.FileSpec myproject.spec.MyFileSpecGenerator.createFileSpec()] threw exception; nested exception is java.lang.NullPointerException
   Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   138 | run      in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run      in     ''
^   680 | run . .  in java.lang.Thread
Caused by BeanDefinitionStoreException: Factory method [public myproject.spec.FileSpec myproject.spec.MyFileSpecGenerator.createFileSpec()] threw exception; nested exception is java.lang.NullPointerException
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   138 | run      in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run      in     ''
^   680 | run . .  in java.lang.Thread
Caused by NullPointerException: null
->> 2027 | createFileSpec in myproject.spec.MyFileSpecGenerator
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|   303 | innerRun in java.util.concurrent.FutureTask$Sync
|   138 | run . .  in java.util.concurrent.FutureTask
|   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
|   908 | run . .  in     ''
^   680 | run      in java.lang.Thread

可能相关:我的资源.groovy

beans = {
    fileSpec(fileSpecGenerator:"createFileSpec")
}
4

0 回答 0