xml解析

今天遇到个郁闷的问题,在启动脚本的时候报了一大堆的错:
nonhupRun.sh[2]: ^M:  not found.
nonhupRun.sh[3]: ^M:  not found.
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351)
        ... 21 more
log4j:WARN File option not set for appender [FILE].
log4j:WARN Are you using FileAppender instead of ConsoleAppender?
11:39:09,757  INFO org.springframework.context.support.ClassPathXmlApplicationContext[prepareRefresh]:378 - Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@6c266c26: display name [org.springframework.context.support.ClassPathXmlApplicationContext@6c266c26]; startup date [Fri Sep 17 11:39:09 GMT+08:00 2010]; root of context hierarchy
log4j:ERROR No output stream or file set for the appender named [FILE].
11:39:09,886  INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader[loadBeanDefinitions]:293 - Loading XML bean definitions from class path resource [ws.spring.xml]
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:618)
        at com.fenet.insurance.datahub.booter.Booter.start(Booter.java:99)
        at com.fenet.insurance.datahub.booter.Booter.main(Booter.java:37)
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 82 in XML document from class path resource [ws.spring.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Invalid byte 3 of 3-byte UTF-8 sequence.
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:359)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:303)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
        at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:173)
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
        at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
        at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
        at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:389)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:324)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
        at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
        at com.fenet.insurance.datahub.BeanManager.initialize(BeanManager.java:21)
        at com.fenet.insurance.datahub.booter.Main.init(Main.java:20)
        at com.fenet.insurance.webservice.WSMain.main(WSMain.java:20)
        ... 6 more
Caused by: org.xml.sax.SAXParseException: Invalid byte 3 of 3-byte UTF-8 sequence.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:76)
        at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:351)
        ... 21 more

找了很久,也不知道是哪错了,最后到网上查了下"Invalid byte 3 of 3-byte UTF-8 sequence",有篇文章是说有字符编码的问题,把那个乱码的那个配置文件删掉,重新上传下,好了,果然是那个问题。。。 关键是配置文件中的中文注释变成乱码了,xml解析不了了

你可能感兴趣的:(java,apache,spring,xml,log4j)