Grails 1.2.1 with Spring 3.0.0 dependency problem under Jetty

只谈情不闲聊 提交于 2019-12-23 01:35:07

问题


Just moved to Grails 1.2.1 (used 1.1.1 before). Changed application.properties, ran grails upgrade, fixed BuildConfig and Bootstrap - everything works just fine from grails console.

However, getting a problem when deploy packaged war under jetty 6.1.22:

1581 [main] ERROR org.springframework.web.context.ContextLoader  - Context initialization failed org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NoSuchMethodError: org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.setParameterNameDiscoverer(Lorg/springframework/core/ParameterNameDiscoverer;)V

My project is built with maven2. I researched the war dependencies and see that both spring 2.5.6 and 3.0.0.RELEASE are used there. I then tried to suppress use of spring 2.5.6 and got a problem with Acegi plugin (using version 0.5.1):

2010-03-10 21:06:56.440:WARN::Nested in org.springframework.beans.factory.access.BootstrapException: Error executing bootstraps; nested exception is java.lang.NoSuchMethodError: org.springframework.web.context.ConfigurableWebApplicationContext.setId(Ljava/lang/String;)V

Any help would be greatly appreciated.


回答1:


The problem is caused by the fact that in new version of Spring ConfigurableWebApplicationContext is located in spring-web.jar, but the interface it inherits ConfigurableApplicationContext, which contains setId(String) method is in located in spring-context.jar.

If you have a library which has been compiled against older version of spring-context it will fail with NoMethodFound exception.

The solution is to locate and recompile that library against latest Spring version.

If you are using Spring version below 3.0 you could try to put full Spring bundle Jar instead of separate packages.



来源:https://stackoverflow.com/questions/2419745/grails-1-2-1-with-spring-3-0-0-dependency-problem-under-jetty

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