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

发布于 2024-12-11 02:32:53 字数 4642 浏览 0 评论 0原文

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

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

I'm trying to upgrade a Grails application from 1.0.3 to 1.3.7.

I've created a Grails 1.3.7 project, and have done my best to copy over the old classes and other files the new project. Of course, something has gone wrong:

$ 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

If you look through this stack trace, you will find no references to the code of my application, which is making it hard for me to track down.

I need some suggestions of what I could check that could this error. Here is my applicationContext.xml which seems unlikely to be the problem:

<?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>

Help is greatly appreciated, and just let me know if more information is needed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

痞味浪人 2024-12-18 02:32:53

根据我将项目从 Grails 1.0.3 升级到 1.3.7 时所做的笔记(并非所有这些步骤都可能是必要的):

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

From the notes I took when I upgraded a project from Grails 1.0.3 to 1.3.7 (not all these steps may be necessary):

  • Make sure your project source are in packages (i.e., "com.companyname.projectname", not in the default package)
  • Make sure plugin source are also in packages (i.e., "org.grails.pluginname", not in the default package)
  • Remove hibernate.jar from the project\lib directory (hibernate is now a plugin)
  • With GRAILS_HOME set to the new version, create a dummy project and copy the fresh BuildConfig.groovy into the project to be upgraded
  • Run "grails upgrade" and answer "y" to the prompts
笑忘罢 2024-12-18 02:32:53

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

Take a look in stacktrace.log, it will possibly give you a better understanding of the actual problem.
Also try "grails clean" and "grails compile" before "grails run-app" to see if it's a problem with old garbage.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文