首页 > 解决方案 > 将 Grails (2.2.4) 应用程序从 JBoss 5.1 迁移到 Wildfly 8.2.1

问题描述

我是 grails 新手,正在尝试将 Grails (2.2.4) 应用程序(在 jdk 1.6 上)从 JBOSS 5.1 迁移到 Wildfly 8.2.1 服务器。由于 wildfly 采用默认的类加载器,我在 jboss-web.xml 中注释掉了类加载标签。在此之后,我做了以下步骤。

  1. 运行命令:grails test war。
  2. 在 Wildfly 8.2.1 上部署

部署失败并出现错误:

 ERROR [StackTrace] (MSC service thread 1-5) Full Stack Trace:: org.springframework.beans.factory.BeanCreationException: **Error creating bean with name 'pluginManager' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: ** Invocation of init method failed; nested exception is java.lang.NullPointerException: Cannot invoke method getAt() on null object

ApplicationContext.xml 如下所示:

<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 <bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
        <description>Grails application factory bean</description>
        <property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
        <property name="grailsResourceLoader" ref="grailsResourceLoader" />
    </bean>

    <bean id="pluginManager" class="org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean">
        <description>A bean that manages Grails plugins</description>
        <property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
        <property name="application" ref="grailsApplication" />
    </bean>

    <bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator">
        <constructor-arg>
            <ref bean="grailsApplication" />
        </constructor-arg>
        <property name="pluginManager" ref="pluginManager" />
    </bean>

    <bean id="grailsResourceLoader" class="org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean" />

    <bean id="characterEncodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter">
        <property name="encoding">
            <value>utf-8</value>
        </property>
    </bean>
</beans>

根据其他帖子中给出的建议,我尝试在删除“grailsResourceLoader”bean(因为它已被弃用)及其参考后进行部署,但仍然出现同样的问题。我使用 jdk 1.6 和 1.7 进行应用,但没有用。

需要更改配置才能在 wildfly 8.2.1 上运行的任何其他文件?任何想法可能是什么问题?谢谢。

标签: javaspringgrailswildfly-8jboss5.x

解决方案


能够通过将项目的 jdk 版本更改为 1.7 以及 Wildfly 8.2.1 来部署战争


推荐阅读