运行grailsrun-app命令时,缓存被停用,无法创建缓存

运行grailsrun-app命令时,缓存被停用,无法创建缓存,grails,embedded-tomcat-7,run-app,Grails,Embedded Tomcat 7,Run App,我在Windows上使用Grails2.3.5,并使用命令行中的GrailsCreateApp命令创建了该项目。当我从命令行运行grailsrun-app--verbose时,我得到下面的异常 Caching deactivated: failed to create cache directory: C:/grails/2.3.5/ java.lang.NoClassDefFoundError: org/apache/catalina/startup/Tomcat at... Caused

我在Windows上使用Grails2.3.5,并使用命令行中的GrailsCreateApp命令创建了该项目。当我从命令行运行grailsrun-app--verbose时,我得到下面的异常

Caching deactivated: failed to create cache directory: C:/grails/2.3.5/
java.lang.NoClassDefFoundError: org/apache/catalina/startup/Tomcat
  at...
Caused by: java.lang.ClassNotFoundException: org.apache.cataliina.startup.Tomcat
下面是我的BuildConfig.groovy文件的一部分

...
      dependencies {
        // specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
        //compile 'xlan:serializer:jar:2.7.1'
        // runtime 'mysql:mysql-connector-java:5.1.27'
        // runtime 'org.postgresql:postgresql:9.3-1100-jdbc41'
        //These were added for mongodb
        compile 'org.grails:grails-datastore-gorm:3.1.0.RELEASE'
        compile 'org.grails:grails-datastore-core:3.1.0.RELEASE'
        test 'org.grails:grails-datastore-simple:3.1.0.RELEASE'
        compile "net.sf.ehcache:ehcache-core:2.4.6"
        compile 'org.grails:grails-async:jar:2.3.8'
        compile 'org.springframework:spring-tx:3.2.8.RELEASE'
    }

    plugins {
        // plugins for the build system only
        //build ":serializer:2.7.1"
        build ':tomcat:7.0.50'
        // plugins for the compile step
        compile ":scaffolding:2.0.1"

        //compile ':cache:1.1.1'
        compile ':mongodb:3.0.1'
        compile ":jquery-ui:1.10.3"

        compile ":spring-security-core:2.0-RC4"
        // plugins needed at runtime but not for compilation
       // runtime ":hibernate:3.6.10.7" // or ":hibernate4:4.1.11.6"
        runtime ":database-migration:1.3.8"
        runtime ":jquery:1.10.2.2"
        runtime ":resources:1.2.1"
        // Uncomment these (or add new ones) to enable additional resources capabilities
        //runtime ":zipped-resources:1.0.1"
        //runtime ":cached-resources:1.1"
        //runtime ":yui-minify-resources:0.1.5"
    }...
我正在运行指向本地存储库的grails脱机模式。 只有在我将下面列出的jar添加到我的Groovy/Grails工具套件文件夹中的lib文件夹中,使它们位于类路径中之后,才能成功编译 (这修复了catalina中的TomcatKillSwitch错误)

  • 卡塔琳娜·贾尔
  • catalina-ant.jar
  • catalina-ha.jar
  • catalina-tribes.jar
  • tomcat-api.jar
  • tomcat-coyote.jar
  • tomcat-util.jar

  • 为什么grails找不到Tomcat,为什么它不能创建缓存?

    删除那些jar文件;您可能已经“修复”了这个问题,但实际上您只是隐藏了一个症状,问题仍然存在,并且很可能会在下次添加插件时重新出现。继续删除lib目录——它可能会继续吸引你

    在我看来,核心问题简单明了;Grails无法创建
    C:/Grails/2.3.5/
    。副作用没有明确说明,其中之一是Grails无法正确地解包Tomcat插件(可能还有其他插件),并用其源代码和jar依赖项扩展类路径

    解决这个问题的正确方法是升级到合理的操作系统。我建议使用Linux,其他人则会在成为一大群想法怪异的“个人”中找到安慰,并建议使用OSX,但实际上除了Windows以外的任何东西都可以

    我将在这里冒险宣称,如果你承担手动创建
    c:\grails
    的任务,你就可以结束这段黑暗的缓存贫困期。默认情况下,在最新版本的Windows中,您不能在C:驱动器的根目录中创建文件或目录;当然,这是可能的,在这段旅程中,你会被问到太多“你确定”类型的问题,但这是可以做到的


    重新启动后,您的缓存将变得丰富,因为Grails将能够创建2.3.5目录,解包插件,并以编程方式引用以前下载/缓存的Tomcat JAR,而不必将它们放在lib目录中。

    我已经尝试了clean、clean all以及删除目标文件夹的命令谢谢,这就是问题所在。我的管理员不允许我写入c:驱动器。因此,我更改了GRAILS_AGENT_CACHE_DIR环境变量,使其指向一个我可以编写的位置,并且,对于jar问题,我再也无法创建.GRAILS/2.3.5目录了。我按照你的建议把所有的罐子都拿走了。结果错误是ClassDefNotFoundException,即org.apache.catilina.Tomcat。我通过清除user/.m2/repository文件夹并重新编译来解决这个问题,这样丢失的依赖项将被刷新,而实际上tomcat-embed-core.jar丢失了。这解决了运行应用程序和编译问题。谢谢你的回答!