Grails 2.4.2 - ERROR context.ContextLoader - Context initialization failed

痴心易碎 提交于 2019-12-08 09:21:33

问题


I have a Grails 2.4.2 application that runs fine in one environment. Now, we need to set it up in another environment wherein we have some restrictions related to accessing the Maven Repositories. So, I had to make some changes in BuildConfig.groovy file to make the application run fine in the new environment. I have access to the JARs and the local version of code for a custom plugin.

I have installed the JARs into my local Maven repository and placed the code files for the custom plugin locally in the same directory as my project code. I have made the following changes in my BuildConfig.groovy file to resolve the errors that came up.

Specify the local custom plugin:

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

Instead of the following statement in plugins block:

compile ':custom-plugin:1.0'

Specify the following in the repositories block:

mavenRepo "http://repo.grails.org/grails/core"

mavenRepo "http://repo.grails.org/grails/plugins/"

Specify the following in the dependencies block:

compile 'org.springframework:spring-aop:4.0.5.RELEASE'

compile 'org.springframework:spring-expression:3.0.2.RELEASE'

However, with these changes I am getting a strange error message when I do grails run-app that I am unable to understand. The error log is mentioned below:

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

Can somebody kindly point me to some direction, as to why this strange error is coming and how can I resolve this?

Any help would be greatly appreciated.


回答1:


Apparently this issue was caused due to some kind of internal conflicts within the Framework that arose when I added the following statements:

Specify the following in the repositories block:

mavenRepo "http://repo.grails.org/grails/core"

mavenRepo "http://repo.grails.org/grails/plugins/"

Specify the following in the dependencies block:

compile 'org.springframework:spring-aop:4.0.5.RELEASE'

compile 'org.springframework:spring-expression:3.0.2.RELEASE'

Upon removing these from the BuildConfig.groovy file, I was able to make the application run fine using grails run-app.

I don't really understand the exact cause of this issue though. If somebody could shed some light upon the root cause, that would be great.



来源:https://stackoverflow.com/questions/29399213/grails-2-4-2-error-context-contextloader-context-initialization-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!