【问题标题】:Heroku error after Atlassian Bamboo deployAtlassian Bamboo 部署后 Heroku 错误
【发布时间】:2012-11-11 12:55:06
【问题描述】:

我正在使用 Atlassian Bamboo Heroku 插件来构建我的 Java Web 应用程序并将其部署到 Heroku。构建成功执行,然后将 war 文件上传到现在应该可用的 Heroku,但是,我得到了标准的 Heroku 应用程序错误页面,并且可以在我的 Heroku 日志中看到以下内容:

 2012-11-11T12:41:12+00:00 app[web.1]: INFO: Initializing Spring root WebApplicationContext
2012-11-11T12:41:17+00:00 app[web.1]:   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
2012-11-11T12:41:17+00:00 app[web.1]:   at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
2012-11-11T12:41:17+00:00 app[web.1]:   at java.util.concurrent.FutureTask.run(FutureTask.java:166)
2012-11-11T12:41:17+00:00 app[web.1]:   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
2012-11-11T12:41:17+00:00 app[web.1]:   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
2012-11-11T12:41:17+00:00 app[web.1]:   at java.lang.Thread.run(Thread.java:636)
2012-11-11T12:41:17+00:00 app[web.1]: Nov 11, 2012 12:41:17 PM org.apache.catalina.core.StandardContext startInternal
2012-11-11T12:41:17+00:00 app[web.1]: SEVERE: Error listenerStart
2012-11-11T12:41:17+00:00 app[web.1]: Nov 11, 2012 12:41:17 PM org.apache.catalina.core.StandardContext listenerStart
2012-11-11T12:41:17+00:00 app[web.1]: SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener
2012-11-11T12:41:17+00:00 app[web.1]: java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded
2012-11-11T12:41:17+00:00 app[web.1]:   at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:137)
2012-11-11T12:41:17+00:00 app[web.1]:   at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:117)
2012-11-11T12:41:17+00:00 app[web.1]:   at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)
2012-11-11T12:41:17+00:00 app[web.1]:   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
2012-11-11T12:41:17+00:00 app[web.1]:   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
2012-11-11T12:41:17+00:00 app[web.1]:   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
2012-11-11T12:41:17+00:00 app[web.1]:   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
2012-11-11T12:41:19+00:00 app[web.1]: Nov 11, 2012 12:41:19 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
2012-11-11T12:41:19+00:00 app[web.1]: INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [2,144] milliseconds.
2012-11-11T12:41:19+00:00 app[web.1]: Nov 11, 2012 12:41:19 PM org.apache.catalina.core.StandardContext startInternal
2012-11-11T12:41:19+00:00 app[web.1]: SEVERE: Context [/] startup failed due to previous errors
2012-11-11T12:41:19+00:00 app[web.1]: SEVERE: Context [/] failed in [org.apache.catalina.core.StandardContext] lifecycle. Allowing Tomcat to shutdown.
2012-11-11T12:41:19+00:00 app[web.1]: Nov 11, 2012 12:41:19 PM org.apache.catalina.core.ApplicationContext log
2012-11-11T12:41:19+00:00 app[web.1]: INFO: Shutting down log4j
2012-11-11T12:41:19+00:00 app[web.1]: INFO: Closing Spring root WebApplicationContext

如果我从控制台安装应用程序战争(使用 git push heroku master),一切似乎都可以正常工作。

【问题讨论】:

    标签: heroku bamboo


    【解决方案1】:

    看起来如果我想使用 Log4jConfigListener,它只适用于扩展的 WAR。 Bamboo Heroku 插件必须将其部署为未扩展,这导致了我的问题。我将删除 Log4jConfigListener,并以另一种方式重新配置日志记录。

    来自 Spring 日志 (http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/util/Log4jConfigListener.html):

    Web 中自定义 log4j 初始化的引导侦听器 环境。委托给 Log4jWebConfigurer(参见它的 javadoc 配置细节)。警告:假设一个扩展的 WAR 文件,两者 用于加载配置文件和写入日志文件。如果 你想保持你的 WAR 不扩展或不需要 WAR 目录中特定于应用程序的日志文件,不要使用 应用程序中的 log4j 设置(因此,不要使用 Log4jConfigListener 或 Log4jConfigServlet)。相反,使用全局, VM 范围的 log4j 设置(例如,在 JBoss 中)或 JDK 1.4 java.util.logging(也是全局的)。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-03-25
    • 1970-01-01
    • 2021-11-30
    • 2019-01-21
    • 2021-11-02
    • 2018-07-10
    相关资源
    最近更新 更多