Grails 2.3.1 没有运行

Posted

技术标签:

【中文标题】Grails 2.3.1 没有运行【英文标题】:Grails 2.3.1 not running 【发布时间】:2013-11-17 19:10:36 【问题描述】:

我在这里感到遗憾的是看起来完全相同的问题: Grails 2.3.0 Not Running

然而,这些尝试性的解决方案都没有任何效果。

当我尝试跑步时

grails clean --stacktrace

我明白了:

    | Environment set to development.
| Error Error executing script Clean: _GrailsClasspath_groovy$_run_closure1 (NOT
E: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.NoClassDefFoundError: _GrailsClasspath_groovy$_run_closure1
        at _GrailsClasspath_groovy.run(_GrailsClasspath_groovy:39)
        at _GrailsClasspath_groovy$run.call(Unknown Source)
        at _GrailsEvents_groovy$run.call(Unknown Source)
        at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
        at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
        at _GrailsEvents_groovy.run(_GrailsEvents_groovy:32)
        at _GrailsEvents_groovy$run.call(Unknown Source)
        at _GrailsClean_groovy$run.call(Unknown Source)
        at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
        at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
        at _GrailsClean_groovy.run(_GrailsClean_groovy:29)
        at _GrailsClean_groovy$run.call(Unknown Source)
        at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
        at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
        at Clean.run(Clean.groovy:25)
        at Clean$run.call(Unknown Source)
        at gant.Gant.prepareTargets(Gant.groovy:607)
Caused by: java.lang.ClassNotFoundException: _GrailsClasspath_groovy$_run_closur
e1
        ... 17 more
| Error Error executing script Clean: _GrailsClasspath_groovy$_run_closure1

根据我尝试过的链接:

删除我的应用程序的目标目录 删除我的主目录的 .grails/.slcache 删除我工作区的 .metadata.plugins\org.grails.ide.eclipse.core\2.3.1.slcache

在尝试其中任何一个之前,我擦除了我的 grails_home 目录并替换为重新下载的 grails 2.3.1 副本

恢复 Grails 2.1.5 也没有帮助

堆栈跟踪中没有任何内容指向我明确创作的任何内容,因此我对自己可能做错的事情感到茫然。

我正在使用/运行:

64位java版本1.7.0_45 Groovy 2.1.9 Windows 7 Enterprise SP1,64 位操作系统

我创建了一个任意 grails 应用程序来引用它所引用的 BuidConfig,因为我正在尝试从 Grails 2.1.5 升级并运行

完整的堆栈跟踪是:

    | Loading Grails 2.3.1
| Configuring classpath
| Configuring classpath.
| Environment set to development
| Environment set to development.
| Error Error executing script RunApp: _GrailsClasspath_groovy$_run_closure1
java.lang.NoClassDefFoundError: _GrailsClasspath_groovy$_run_closure1
    at _GrailsClasspath_groovy.run(_GrailsClasspath_groovy:39)
    at _GrailsClasspath_groovy$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at _GrailsEvents_groovy$run.call(Unknown Source)
    at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
    at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at _GrailsEvents_groovy.run(_GrailsEvents_groovy:32)
    at _GrailsEvents_groovy$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at _GrailsClean_groovy$run.call(Unknown Source)
    at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
    at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at _GrailsClean_groovy.run(_GrailsClean_groovy:29)
    at _GrailsClean_groovy$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at _GrailsWar_groovy$run.call(Unknown Source)
    at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
    at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at _GrailsWar_groovy.run(_GrailsWar_groovy:27)
    at _GrailsWar_groovy$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at _GrailsRun_groovy$run.call(Unknown Source)
    at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
    at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at _GrailsRun_groovy.run(_GrailsRun_groovy:28)
    at _GrailsRun_groovy$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:59)
    at org.codehaus.gant.IncludeTargets$leftShift.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    at RunApp.run(RunApp.groovy:25)
    at RunApp$run.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at gant.Gant.prepareTargets(Gant.groovy:607)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeWithGantInstance(GrailsScriptRunner.java:769)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptFile(GrailsScriptRunner.java:571)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeScriptWithCaching(GrailsScriptRunner.java:470)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.callPluginOrGrailsScript(GrailsScriptRunner.java:414)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.executeCommand(GrailsScriptRunner.java:378)
    at org.codehaus.groovy.grails.cli.GrailsScriptRunner.main(GrailsScriptRunner.java:226)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:235)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:263)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1254)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.rootLoader(GrailsStarter.java:235)
    at org.codehaus.groovy.grails.cli.support.GrailsStarter.main(GrailsStarter.java:263)
Caused by: java.lang.ClassNotFoundException: _GrailsClasspath_groovy$_run_closure1
    at org.codehaus.groovy.tools.RootLoader.findClass(RootLoader.java:175)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at org.codehaus.groovy.tools.RootLoader.loadClass(RootLoader.java:147)
    at org.codehaus.groovy.grails.cli.support.GrailsRootLoader.loadClass(GrailsRootLoader.java:51)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    ... 72 more
| Error Error executing script RunApp: _GrailsClasspath_groovy$_run_closure1

【问题讨论】:

你能发布你的完整堆栈跟踪吗? 我编辑添加了完整的堆栈跟踪,因为它太长而无法放入 cmets 以及情况不是特定于 grails 版本的警告 【参考方案1】:

grails.project.work.dir - 默认情况下类似于~/.grails/projects/$appName 有一个名为:“scriptCache”的目录

清空 scriptCache 内容使我能够继续前进。

【讨论】:

以上是关于Grails 2.3.1 没有运行的主要内容,如果未能解决你的问题,请参考以下文章

在Grails 3中运行Grails功能测试

grails 4没有枚举常量?

Grails 4:独立端口

我如何在 grails 2.3.1 中使用控制器来休息 api?

无法运行 Grails 项目 GGTS

Grails 依赖解决问题