我有一个在一个环境中运行良好的 Grails 2.4.2 应用程序。现在,我们需要在另一个环境中设置它,其中我们有一些与访问 Maven 存储库相关的限制。因此,我不得不在 BuildConfig.groovy 文件中进行一些更改,以使应用程序在新环境中运行良好。我可以访问自定义插件的 JAR 和本地版本的代码。
我已将 JAR 安装到我的本地 Maven 存储库中,并将自定义插件的代码文件本地放置在与我的项目代码相同的目录中。我在 BuildConfig.groovy 文件中进行了以下更改以解决出现的错误。
指定本地自定义插件:
grails.plugin.location."custom-plugin" = "../custom-plugin/"
而不是 plugins 块中的以下语句:
compile ':custom-plugin:1.0'
在存储库块中指定以下内容:
mavenRepo "http://repo.grails.org/grails/core"
mavenRepo "http://repo.grails.org/grails/plugins/"
在依赖项块中指定以下内容:
compile 'org.springframework:spring-aop:4.0.5.RELEASE'
compile 'org.springframework:spring-expression:3.0.2.RELEASE'
但是,通过这些更改,我收到一条奇怪的错误消息grails run-app
,我无法理解。错误日志如下所述:
Error |
2015-04-01 11:18:50,655 [localhost-startStop-1] ERROR context.ContextLoader - Context initialization failed
Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: NULL
Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run in ''
^ 662 | run . . in java.lang.Thread
Caused by NoSuchFieldError: NULL
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run in ''
^ 662 | run . . in java.lang.Thread
Error |
2015-04-01 11:18:50,716 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: NULL
Message: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.NoSuchFieldError: NULL
Line | Method
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run in ''
^ 662 | run . . in java.lang.Thread
Caused by NoSuchFieldError: NULL
->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 138 | run in java.util.concurrent.FutureTask
| 895 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
| 918 | run in ''
^ 662 | run . . in java.lang.Thread
Process finished with exit code 1
有人可以向我指出一些方向,为什么会出现这个奇怪的错误,我该如何解决这个问题?
任何帮助将不胜感激。