$highlight=array();
这是我的xml文件,但是当我部署时,我收到了错误<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context" xmlns:hsf="http://www.taobao.com/hsf"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.taobao.com/hsf http://www.taobao.com/hsf/hsf.xsd">
<hsf:consumer id="fcAccountQueryService"
interface="com.aliexpress.finance.open.fcaccount.share.service.FcAccountQueryService"
version="1.0.0" group="DUBBO" />
</beans>
。为什么呢?
另一个xml第6行是
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 6 in XML document from class path resource [biz/consumer/services/spring_fc_account_services.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Invalid byte 2 of 2-byte UTF-8 sequence.
答案 0 :(得分:0)
答案 1 :(得分:0)
可能会有一些您无法看到的特殊字符,因为编辑器,终端,gedit工具等不支持该字符。
处理我发现的同一异常的另一种方法是
new String(bytes,"ISO-8859-1").getBytes("UTF-16");
如果您的内容提供SAXException:2字节UTF-8序列的字节2无效。
答案 2 :(得分:0)
我尝试以UTF-8
格式保存文件,在ISO-8859-1
中,我再次收到错误。所以它不是由编码造成的
我尝试将相同的xml文件添加到其他spring应用程序,它的工作原理。我确定所有的xml文件都是一样的
然后我比较了两个应用程序的依赖关系。我发现效果很好的应用程序依赖hsf
在我的xml文件中,我使用了http://www.taobao.com/hsf http://www.taobao.com/hsf/hsf.xsd
xsd。所以我将hsf
依赖项添加到我的pom.xml中,所有问题都解决了,应用程序开始成功了!