我正在尝试通过运行“grails dev war”命令并手动将 war 部署到 Tomcat 容器中来在测试环境中部署 grails 应用程序。该应用程序未运行,我看到了几个类似这样的错误日志:
./logs/catalina.out:2014-01-13 09:18:53,415 [main] ERROR context.GrailsContextLoader - Error initializing the application: Error creating bean with name 'instanceTagLibraryApi': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void org.codehaus.groovy.grails.plugins.web.api.TagLibraryApi.setGspTagLibraryLookup(org.codehaus.groovy.grails.web.pages.TagLibraryLookup); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gspTagLibraryLookup': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'es.indra.nta.UiLayoutsTagLib': Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.apache.catalina.loader.WebappClassLoader' to required type 'groovy.lang.GroovyClassLoader' for property 'classLoader'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.apache.catalina.loader.WebappClassLoader] to required type [groovy.lang.GroovyClassLoader] for property 'classLoader': no matching editors or conversion strategy found
我在几个 bean 上遇到了同样的错误。我正在使用 Grails 2.2.2
并尝试在 Tomcat 5.5 和 7.0 中部署,结果相同。如果我使用 'grails run-app'
而不是应用程序运行平稳,因此我怀疑缺少与 Tomcat 相关的一些配置,但不知道配置什么以及在哪里配置。
关于我缺少什么的任何想法?
感谢您的帮助!
大卫。
最佳答案
我升级到 grails 2.2.x(从 1.3.7)时遇到了类似的问题
在 application.properties
中,我有
plugins.tomcat=2.2.x
我不得不删除它并添加到 grails-app/conf/BuildConfig.groovy
中:
plugins {
build ':tomcat:2.2.x'
}
它解决了我的问题,我希望它也能解决你的问题。
关于spring - 在tomcat中部署grails war时类加载器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21090091/