【问题标题】:Grails 2.4.2 - ERROR context.ContextLoader - Context initialization failedGrails 2.4.2 - 错误 context.ContextLoader - 上下文初始化失败
【发布时间】:2015-06-06 14:19:54
【问题描述】:

我有一个在一个环境中运行良好的 Grails 2.4.2 应用程序。现在,我们需要在另一个环境中设置它,其中我们有一些与访问 Maven 存储库相关的限制。因此,我不得不对 BuildConfig.groovy 文件进行一些更改,以使应用程序在新环境中运行良好。我可以访问自定义插件的 JAR 和本地版本的代码。

我已将 JAR 安装到我的本地 Maven 存储库中,并将自定义插件的代码文件本地放置在与我的项目代码相同的目录中。我在 BuildConfig.groovy 文件中进行了以下更改以解决出现的错误。

指定本地自定义插件:

grails.plugin.location."custom-plugin" = "../custom-plugin/"

代替插件块中的以下语句:

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

有人可以指出一些方向,为什么会出现这个奇怪的错误,我该如何解决这个问题?

任何帮助将不胜感激。

【问题讨论】:

    标签: grails-2.4 run-app


    【解决方案1】:

    显然,这个问题是由于我添加以下语句时出现的框架内的某种内部冲突引起的:

    在存储库块中指定以下内容:

    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'

    BuildConfig.groovy 文件中删除这些后,我能够使用grails run-app 使应用程序运行良好。

    不过,我并不真正了解此问题的确切原因。如果有人能阐明根本原因,那就太好了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-06-09
      • 2015-04-26
      • 2015-12-15
      • 1970-01-01
      • 1970-01-01
      • 2018-09-29
      • 2015-11-12
      • 1970-01-01
      相关资源
      最近更新 更多