【问题标题】:Can't run-app on Grails无法在 Grails 上运行应用程序
【发布时间】:2012-07-29 23:24:43
【问题描述】:

我刚刚安装了 Groovy 2.0.1 和 Grails 2.1.0。

正在按照有关如何在以下位置创建简单的 Hello World Web 应用程序的说明进行操作:

http://grails.org/doc/latest/guide/gettingStarted.html#creatingAnApplication

当我尝试运行应用程序时,出现以下错误:

grails> 运行应用程序

| 
Compiling 113 source files
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
    | Running Grails application
    | Error 2012-07-27 17:05:41,773 [pool-4-thread-1] ERROR core.ContainerBase
      - A child        container failed during start
Message: org.apache.catalina.LifecycleException: Failed to start component
   [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/helloworld]]
    Line | Method
    ->> 222 | innerGet in java.util.concurrent.FutureTask$Sync

Caused by LifecycleException: Failed to start component 
   [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[/helloworld]]
    ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync

Caused by NoSuchMethodError:  
 javax.servlet.ServletContext.getSessionCookieConfig()Ljavax/servlet/SessionCookieConfig;
    ->> 303 | innerRun in java.util.concurrent.FutureTask$Sync
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    |   138 | run      in java.util.concurrent.FutureTask
    |   886 | runTask  in java.util.concurrent.ThreadPoolExecutor$Worker
    |   908 | run      in     ''
 ^   680 | run . .  in java.lang.Thread
    | Error 2012-07-27 17:05:41,869 [main] ERROR core.ContainerBase
    A child container failed during start

   Message: org.apache.catalina.LifecycleException: Failed to start component
  [StandardEngine[Tomcat].StandardHost[localhost]]
  Line | Method
  ->> 222 | innerGet  in java.util.concurrent.FutureTask$Sync
  |    83 | get       in java.util.concurrent.FutureTask
  |   137 | doStart . in org.grails.plugins.tomcat.InlineExplodedTomcatServer
  |   102 | start     in org.grails.plugins.tomcat.TomcatServer
  |   176 | doCall .  in RunApp$_run_closure5_closure12
  |   153 | doCall    in RunApp$_run_closure5
  |   121 | runInline in RunApp
  |    67 | doCall    in RunApp$_run_closure1
  ^    33 | doCall .  in     ''

  Caused by LifecycleException: Failed to start component
  [StandardEngine[Tomcat].StandardHost[localhost]]
  ->> 303 | innerRun  in java.util.concurrent.FutureTask$Sync

  |   138 | run       in java.util.concurrent.FutureTask
  |   886 | runTask . in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run       in     ''
  ^   680 | run . . . in java.lang.Thread

  Caused by LifecycleException: A child container failed during start
  ->> 303 | innerRun  in java.util.concurrent.FutureTask$Sync

  |   138 | run       in java.util.concurrent.FutureTask
  |   886 | runTask . in java.util.concurrent.ThreadPoolExecutor$Worker
  |   908 | run       in     ''
  ^   680 | run . . . in java.lang.Thread
  | Error Failed to start component [StandardServer[-1]] 
   (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
   org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
at
   org.grails.plugins.tomcat.
      InlineExplodedTomcatServer.doStart(InlineExplodedTomcatServer.groovy:137)
at org.grails.plugins.tomcat.TomcatServer.start(TomcatServer.groovy:102)
at RunApp$_run_closure5_closure12.doCall(RunApp:176)
at RunApp$_run_closure5.doCall(RunApp:153)
at RunApp.runInline(RunApp:121)
at RunApp$_run_closure1.doCall(RunApp:67)
at RunApp$_run_closure1.doCall(RunApp.groovy:33)
  Caused by: org.apache.catalina.LifecycleException: Failed to start component
  [StandardService[Tomcat]]
... 7 more
  Caused by: org.apache.catalina.LifecycleException: Failed to start component
  [StandardEngine[Tomcat]]
... 7 more
  Caused by: org.apache.catalina.LifecycleException: A child container failed during start
... 7 more
  | Error Server failed to start: org.apache.catalina.LifecycleException: Failed to start component [StandardServer[-1]]
  | Error Error running script run-app: org.codehaus.groovy.grails.cli.ScriptExitException
  (Use --stacktrace to see the full trace)

我可能做错了什么?本教程没有指定在任何地方为 tomcat 设置配置?

【问题讨论】:

  • 它使用从主 grails 存储库下载的嵌入式 tomcat 实例。您的类路径中是否有任何 tomcat 实例?其他 xml 库呢?当您尝试使用不同的端口 ( grails -Dserver.port=9090 run-app ) 在 shell 之外运行它时会发生什么。

标签: grails


【解决方案1】:

@tomas 你是对的!切换到不同的端口建议不起作用。从我的 CLASSPATH 中删除以下 jar 后,我工作得很好。在 .bash_profile 中看起来像这样:

export CLASSPATH=.:"$TOMCAT_HOME/common/lib/servlet-api.jar":"$TOMCAT_HOME/common/lib/jsp-api.jar"; 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-11-03
    • 1970-01-01
    • 2014-04-20
    • 2016-07-20
    • 1970-01-01
    • 1970-01-01
    • 2010-09-28
    相关资源
    最近更新 更多