• 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格式不正确的问题,需要设定打包是的编码格式。

  • 相关阅读:
    Win10 安装GNU 编译器(gcc、g++ 和 gfortran)
    三维地图制作 数据选型 相关参考资料
    借助mapshaper的简化来修复geojson的拓扑错误
    一种改进后的turf.idw算法
    基于Geojson的点集的抽稀Js实现
    OL3-Cesium 二三维鼠标事件统一处理
    About TopoJSON
    基于 geojson数据类型面转线Transforms Polygons and MultiPolygons to LineStrings.
    数据库文档编写辅助脚本
    Extensible Messaging and Presence Protocol (XMPP): Core
  • 原文地址:https://www.cnblogs.com/sidesky/p/11448838.html
Copyright © 2020-2023  润新知