spring - 在tomcat中部署grails war时类加载器错误

标签 spring tomcat grails deployment classloader

我正在尝试通过运行“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/

相关文章:

spring - 如何在 NetBeans IDE 中更新 Spring 和 Hibernate 库?

Spring Boot 设置 SSL 连接报错

java - Google Docs PDF Streaming 比 java servlet Stream 更快?

java - 嵌入式 tomcat 容器没有从应用程序属性中获取上下文路径。(Spring boot)

grails - 动态调度作业:在Groovy中使用cron触发器

grails - 在Web流中使用Grails属性表达式而不是域对象?

java - : SpringBoot方法中Principal是如何注入(inject)的

spring - 不能在 spring 3 中使用 spring-modules-validation

java.sql.SQLException : Connection has already been closed 异常

grails - Grails 3升级测试问题