gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 14:09:13 24 4
gpt4 key购买 nike

我正在尝试将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>

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

最佳答案

从我将项目从Grails 1.0.3升级到1.3.7时所记的笔记(可能并不需要所有这些步骤):

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

    关于grails - 将Grails升级到1.3.7,需要故障排除帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7840136/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com