Deployment exception of the bae and sae caused by the log4j Loading Method, and log4jbaesae deployment
In the past two days, I changed the deployment code on the bae. To facilitate functional testing of the program, I introduced the log4j log, but the problem came .. the test program is built on the spring3.2.8 framework, web. the xml import log code is:
<context-param> <param-name>log4jConfigLocation</param-name> <param-value>classpath:log4j.xml</param-value> </context-param> <!-- <context-param> <param-name>webAppRootKey</param-name> <param-value>app.root</param-value> </context-param> --> <listener> <listener-class> org.springframework.web.util.Log4jConfigListener </listener-class> </listener>
Deployment failed with the following error:
2015-02-12 17:43:06,878 [localhost-startStop-4] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]- Shutting down log4j2015-02-12 17:43:06,877 [localhost-startStop-4] ERROR org.apache.catalina.core.StandardContext- Context [] startup failed due to previous errors2015-02-12 17:43:06,877 [localhost-startStop-4] ERROR org.apache.catalina.core.StandardContext- Error listenerStartat java.lang.Thread.run(Thread.java:724)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)at java.util.concurrent.FutureTask.run(FutureTask.java:166)at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1660)at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:983)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:116)at org.springframework.web.util.WebUtils.setWebAppRootSystemProperty(WebUtils.java:143)java.lang.IllegalStateException: Cannot set web app root system property when WAR file is not expanded2015-02-12 17:43:06,875 [localhost-startStop-4] ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]- Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener2015-02-12 17:43:06,866 [localhost-startStop-4] INFO org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/]- No Spring WebApplicationInitializer types detected on classpath2015-02-12 17:43:02,593 [localhost-startStop-4] INFO org.apache.catalina.startup.HostConfig- Deploying web application archive /home/bae/app/ROOT.war
Because I cannot reproduce the local environment, I can only guess that the war packaging method is in conflict with the loading method of log4j in cloud deployment ..
Finally, I had to try again .. web. do not write the introduce code of log4j in xml, and then set log4j. the xml configuration file is thrown to the default position src to allow spring to automatically load... now the code is successfully deployed on the bae...
As for why I mentioned sae In the title, I was thrown into this issue and could not be deployed on SAES. I had no choice but to transfer it to bae. The same result is true for bae, to realize the unexpected nature of the problem...