我希望有人可以帮助我,因为我真的不确定为什么会这样。 基本上我有一个非常好的Spring应用程序,但是当我没有互联网连接时,它无法在tomcat下部署。
有时会停在这里:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
有时它通过了这个并停在这里:
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Jul 26, 2014 1:50:57 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Jul 26, 2014 1:50:57 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/myapp] startup failed due to previous errors
Jul 26, 2014 1:50:57 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /bla/bla/tomcat-7.0.54/webapps/myapp.war has finished in 1,113 ms
请注意,我没有登录问题或没有Spring的问题。该应用程序在部署时(我有互联网连接)完全正常工作,并按照我想要的方式记录所有内容,这意味着找到并正确读取了log4j.properties。
我真的很困惑,希望有人能找到答案。
提前致谢 中号
行, 我想我知道问题是什么。 打开日志调试后*看到它失败:
NFO: Initializing Spring root WebApplicationContext
Jul 31, 2014 3:05:20 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [dal/dal.xml]
Offending resource: class path resource [SpringContext.xml]; nested exception is org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 123 in XML document from class path resource [dal/dal.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 123; columnNumber: 14; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:218)
...
这表明我的数据访问层初始化失败了,看了之后我意识到我确实有以下的XML文件需要阅读以便初始化应用程序DAO等需要互联网。
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<!--
就是这样。谢谢大家。
此致 中号