BAE and SAE deployment exceptions due to log4j loading mode

Source: Internet
Author: User

This 2-day change to the deployment of the code on BAE, in order to facilitate the functional testing of the program, introduced the log4j log, but the problem came. The test program is built with the spring3.2.8 framework, and the Web. XML introduces the log code:

<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 an 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 was 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 ofclassOrg.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 the local environment I can not reproduce, only guess is the way the war package in the cloud deployment and log4j load mode conflict.

Finally helpless, had to play down Lai. The log4j code is not written in Web. XML, then the Log4j.xml configuration file is dropped to the default location src, so spring automatically loads ... The code was successfully deployed to BAE ...

As to why the title referred to the SAE, because I was the problem of the pit, on the SAE is also not deployed, but turned to BAE, the results of BAE is the same, only to realize the problem of non-contingency ...

BAE and SAE deployment exceptions due to log4j loading mode

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.