2011-10-20 37 views
2

我試圖將Grails應用程序從1.0.3升級到1.3.7。將Grails升級到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> 

幫助是極大的讚賞,只是讓我知道,如果需要更多的信息。

+0

也許拯救這個頭痛,直到下個月的Grails 2.0出來?這樣你就不會再那麼快過時了。 – ubiquibacon

+0

哈哈,好想法。但在我的公司,獲得1.3.7的許可是我們合理希望的前沿。 –

回答

0

採取stacktrace.log一看,這將有可能給你一個更好地瞭解實際的問題。 在「grails run-app」之前嘗試「grails clean」和「grails compile」,看看它是否是舊垃圾的問題。

+0

'stacktrace.log'沒有給我任何真正的洞察力,它看起來像是一樣的堆棧跟蹤。而且我每次都在做'grails clean'。所以謝謝你的建議,但沒有成功。 –

1

從當我從Grails的1.0.3升級一個項目,我1.3.7接過筆記(不是所有這些步驟可能是必要的):

  • 確保您的項目源是在包(即, 「com.companyname.projectname」,不在默認包中)
  • 確保插件源也在包中(即「org.grails.pluginname」,不在默認包中)
  • 將hibernate.jar從項目\ lib目錄(休眠現在是一個插件)
  • 隨着GRAILS_HOME設置爲新的版本錫永,創建一個虛擬的項目和新BuildConfig.groovy複製到項目升級
  • 運行「Grails的升級」,回答「Y」的提示