• java通过maven打包解决xml读取格式失败问题


     <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.2</version>
                    <configuration>
                        <source>${java.version}</source><!-- 源代码开发使用版本 -->
                        <target>${java.version}</target><!-- 源代码编译所使用的版本 -->
                        <encoding>${java.encoding}</encoding>
                        <useIncrementalCompilation>false</useIncrementalCompilation>
                    </configuration>
                </plugin>
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 14 in XML document from class path resource [spring/springmvc-servlet.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 14; columnNumber: 22; Invalid byte 3 of 3-byte UTF-8 sequence.
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:188)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:224)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:195)
            at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:125)
            at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:94)
            at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:133)
            at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:636)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:521)
            at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701)
            at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:667)
            at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:715)
            at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:590)
            at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529)
            at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169)
            at javax.servlet.GenericServlet.init(GenericServlet.java:158)
            at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1269)
            at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1182)
            at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1072)
            at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5393)
            at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5688)
            at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)

    注:在spring xml配置读取的时候,存在utf8格式不正确的问题,需要设定打包是的编码格式。

  • 相关阅读:
    2014 I/O归来:Google连接一切
    Android漫游记(4)---.so文件动态调试一例
    Python笔记之面向对象
    Caffe —— Deep learning in Practice
    JAVA学习笔记 -- 数据结构
    UICollectionView——整体总结
    一些优秀的学习网站(Android)
    10个很棒的学习Android 开发的网站
    Android圆形图片不求人,自定义View实现(BitmapShader使用)
    Android图像处理之冰冻效果
  • 原文地址:https://www.cnblogs.com/sidesky/p/11448838.html
Copyright © 2020-2023  润新知