Atlassian Bamboo部署后的Heroku错误

时间:2012-11-11 12:55:07

标签: heroku bamboo

我使用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

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

1 个答案:

答案 0 :(得分:0)

看起来如果我想使用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初始化的Bootstrap侦听器   环境。代表Log4jWebConfigurer(参见其javadoc for   配置细节)。警告:假设扩展的WAR文件都是   用于加载配置文件和写入日志文件。如果   你想保持你的WAR未扩展或不需要   WAR目录中特定于应用程序的日志文件,请勿使用   应用程序中的log4j设置(因此,请勿使用   Log4jConfigListener或Log4jConfigServlet)。相反,使用全局,   VM范围的log4j设置(例如,在JBoss中)或JDK 1.4   java.util.logging(也是全局的)。