将Grails升级到1.3.7,需要故障排除帮助

时间:2011-10-20 18:00:59

标签: grails upgrade

我正在尝试将Grails应用程序从1.0.3升级到1.3.7。

我已经创建了一个Grails 1.3.7项目,并且尽力将新项目和其他文件复制到新项目中。当然,出了点问题:

$ grails run-app
<--snip-->
Running Grails application..
2011-10-20 13:37:47,195 [main] ERROR context.GrailsContextLoader  - Error executing bootstraps: 
Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: 
Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
    org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: 
Initialization of bean failed; nested exception is java.lang.reflect.MalformedParameterizedTypeException
    at java.security.AccessController.doPrivileged(Native Method)
    at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
    at grails.web.container.EmbeddableServer$start.call(Unknown Source)
    at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
    at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
    at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
    at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
    at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
    at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
    at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
    at RunApp$_run_closure1.doCall(RunApp.groovy:33)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.reflect.MalformedParameterizedTypeException
    at java.lang.Class.getGenericInterfaces(Class.java:788)
    ... 24 more

如果查看此堆栈跟踪,您将找不到我的应用程序代码的引用,这使我很难跟踪。

我需要一些建议,我可以检查这可能是这个错误。这是我的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">
    <property name="grailsResourceHolder" ref="grailsResourceHolder" />
  </bean>

  <bean id="grailsResourceHolder" scope="prototype" class="org.codehaus.groovy.grails.commons.spring.GrailsResourceHolder">
    <property name="resources">
      <value>classpath*:**/grails-app/**/*.groovy</value>
    </property>
  </bean>    

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

非常感谢帮助,如果需要更多信息,请告诉我。

2 个答案:

答案 0 :(得分:1)

从我将项目从Grails 1.0.3升级到1.3.7时所做的注释(并非所有这些步骤都可能是必需的):

  • 确保您的项目源位于包中(即“com.companyname.projectname”,而不是默认包中)
  • 确保插件源也在包中(即“org.grails.pluginname”,而不是默认包中)
  • 从project \ lib目录中删除hibernate.jar(hibernate现在是一个插件)
  • 将GRAILS_HOME设置为新版本,创建一个虚拟项目并将新的BuildConfig.groovy复制到要升级的项目中
  • 运行“grails升级”并在提示中回答“y”

答案 1 :(得分:0)

看看stacktrace.log,它可能会让你更好地了解实际问题。 还要在“grails run-app”之前尝试“grails clean”和“grails compile”,看看它是否是旧垃圾的问题。