grails - 尝试运行应用程序时,Tomcat ClassNotFound异常

标签 grails sts-springsourcetoolsuite

我有一个grails应用程序,直到昨天决定将电子邮件插件下载到STS之前,我的运行情况都很好。下载由于某种原因而失败,我经过几次搜索就解决了这个问题。解决插件问题后,我的应用程序停止工作。我尝试了很多事情,包括重新安装STS。我当时正在维护一个GIT存储库,然后将所有更改都还原到了最后一个已知的工作状态。这也没有帮助。我创建了一个新的Grails项目,并复制了所有我的源文件,并且一切正常。

我比较了工作目录和非工作目录之间的所有构建路径和属性文件,除了.classpath每次我尝试运行如下所示的应用程序时都会更改之外,它们似乎相同。

+       <classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
        <classpathentry kind="con" path="com.springsource.sts.grails.core.CLASSP
-       <classpathentry kind="src" path=".link_to_grails_plugins/tomcat-1.3.7/sr
-               <attributes>
-                       <attribute name="com.springsource.sts.grails.core.SOURCE
-               </attributes>
-       </classpathentry>

谁能帮我解决我应该在哪里找到该应用程序?

这是我得到的错误:
    Welcome to Grails 1.3.7 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /Users/mymac/springsource/grails-1.3.7/
Base Directory: /Users/mymac/MyProjects/MyGitSources/books_grails/books
Resolving dependencies...
Dependencies resolved in 862ms.
Running script /Users/mymac/springsource/grails-1.3.7/scripts/RunApp.groovy
Environment set to development
     [copy] Copying 1 file to /Users/mymac/.grails/1.3.7/projects/books
WARNING: No default container found, installing Tomcat..
Resolving plugin tomcat. Please wait...
Error executing script RunApp: java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
    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.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java_lang_ClassLoader$loadClass.call(Unknown Source)
    at _GrailsRun_groovy$_loadServerFactory_closure11.doCall(_GrailsRun_groovy:85)
    at _GrailsRun_groovy.loadServerFactory(_GrailsRun_groovy:101)
    at _GrailsRun_groovy.this$4$loadServerFactory(_GrailsRun_groovy)
    at _GrailsRun_groovy$this$4$loadServerFactory.callCurrent(Unknown Source)
    at _GrailsRun_groovy.runInline(_GrailsRun_groovy:114)
    at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
    at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
    at RunApp$_run_closure1.doCall(RunApp:33)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    ... 10 more
--- Nested Exception ---
java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at java_lang_ClassLoader$loadClass.call(Unknown Source)
    at _GrailsRun_groovy$_loadServerFactory_closure11.doCall(_GrailsRun_groovy:85)
    at _GrailsRun_groovy.loadServerFactory(_GrailsRun_groovy:101)
    at _GrailsRun_groovy.this$4$loadServerFactory(_GrailsRun_groovy)
    at _GrailsRun_groovy$this$4$loadServerFactory.callCurrent(Unknown Source)
    at _GrailsRun_groovy.runInline(_GrailsRun_groovy:114)
    at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
    at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
    at RunApp$_run_closure1.doCall(RunApp: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)
Error executing script RunApp: java.lang.ClassNotFoundException: org.grails.tomcat.TomcatServerFactory

[更新]:

当我再次尝试在新的工作项目中安装邮件插件时,如果尝试运行应用程序,则会重现相同的错误。插件以某种方式使我的应用程序搞砸了。现在我不知道插件的安装方式以及它们在项目中的变化:-(

谢谢!!

最佳答案

将其发布为答案,以防万一有人需要找到解决方案...

我从〜/ .grails下删除了所有项目,还清除了具有我的项目引用的文件。我将项目重新导入到STS中,然后又开始工作。

我猜问题出在邮件插件上。由于我的Maven存储库在BuildConfig.groovy中被注释掉

//mavenLocal()
//mavenCentral()

插件安装失败,并以某种方式弄乱了我的项目。我创建了一个临时项目,未注释上述行就安装了这些插件,如上所述清理了原始项目,然后重新构建了我的项目。

从现在起,我的插件在本地可用,因此我可以轻松地将其安装到主项目中。

尽管这不是一个干净的方法,并且不确定失败的插件安装是否存在现有问题,但如果有人再次遇到相同问题,我将予以发布!

谢谢!!

关于grails - 尝试运行应用程序时,Tomcat ClassNotFound异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8660572/

相关文章:

grails - 无法运行Grails项目GGTS

java - 如何检查我的任何类是否使用依赖项并在 Maven 中列出它们?

grails - SpringSource : Grails plugins

grails - Grails 3.2.8部署:应用程序启动时o.h.engine.jdbc.spi.SqlExceptionHelper

grails - 如何使用Grails渲染将html转换为pdf?

grails - Grails 中已弃用 install-plugin 命令

grails - Grails 3 Bootstrap -服务不会创建数据库条目

grails - 从本地 Grails 插件中排除依赖项

java - VM 初始化期间发生错误,无法为对象堆保留足够的空间 - Spring Tool Suite?

spring - "Open Live Beans Graph"被禁用