Invalid byte 3 of 3-byte UTF-8 sequence 解決方案
今天將別人的Eclipse專案用IDEA打包部署後時,執行啟動時,遇到了如下錯誤:
13-Mar-2019 11:38:35.398 INFO [localhost-startStop-2] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/root/oos/dev/webapps/dev.war]
13-Mar-2019 11:38:35.842 SEVERE [localhost-startStop-2] org.apache.tomcat.util.descriptor.web.WebXmlParser.parseWebXml Parse error in application web.xml file at [file:/root/oos/dev/webapps/dev/WEB-INF/web.xml]
com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 3 of 3-byte UTF-8 sequence.
at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:701)
根據提示,追蹤到有錯誤提示的檔案 [file:/root/oos/dev/webapps/dev/WEB-INF/web.xml],開啟一看裡面有中文而且亂碼了,我這裡解決方法是直接將中文註釋全部改成英文了,然後一切就OK了,即原因是由於配置檔案中的中文亂碼引起的,注意不是純粹的中文而是亂碼和不正確的編碼格式.
其實還有一種更通用的解決方法如下,新增編譯外掛:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
相關文章
- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc8 in position 0: invalid continuation byteUnicodeError
- PostgreSQL/LightDB copy ERROR: invalid byte sequence for encoding "UTF8": 0x00SQLErrorEncoding
- err Invalid input of type: 'dict'. Convert to a byte, string or number first
- tensorflow讀取圖片時出現錯誤UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid sUnicodeError
- invalid stream header: EFBFBDEF 問題解決Header
- Could not decode a text frame as UTF-8 的解決
- Java謎題3:汽車 - 解決方案Java
- iOS解決CUICatalog: Invalid asset name supplied問題iOSUI
- 解決org.apache.ibatis.binding.BindingException: Invalid boundApacheBATException
- PHP中的Malformed UTF-8 characters錯誤解決PHPORM
- IDEA+Maven:invalid bound statement (not found)解決辦法IdeaMaven
- docker 容器指定utf-8編碼,解決中文亂碼Docker
- 【問題解決】remote: parse error: Invalid numeric literal at line 1, column 20,解決思路REMError
- 解決方案| anyRTC金融音視訊解決方案
- Python 的 3 個主要缺點及其解決方案Python
- IDEA+Maven+Springboot:invalid bound statement (not found) 解決辦法IdeaMavenSpring Boot
- UnexpectedRollbackException解決方案Exception
- Vue3中前臺前端解決方案速記Vue前端
- rpi-mongodb3 容器無法重啟解決方案MongoDB
- Mac Iterm2 連結伺服器報:LC_CTYPE: cannot change locale (UTF-8): No such file or directory 解決方案Mac伺服器
- PyMySQL 獲取資料 'utf-8' codec can't decode byte 0xed in position 2: 錯誤MySql
- sequence to sequence模型模型
- Python讀取檔案時出現UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position xx: 解決方案PythonUnicodeError
- 高併發解決方案詳解(9大常見解決方案)
- react-navigation升級3.x 問題解決方案ReactNavigation
- vue-cli3構建專案跨域解決方案Vue跨域
- 關於ESLint: Delete `␍`(prettier/prettier) 錯誤解決方案(3種)EsLintdelete
- SpringBoot3整合Druid資料來源的解決方案Spring BootUI
- 厚石工業交換機3大應用解決方案
- 高可用解決方案
- Redis bigkey解決方案Redis
- 前端整合解決方案前端
- Feast on Amazon 解決方案AST
- 解決eclipse的 Invalid project description. overlaps the location of another project: 問題EclipseProject
- sublime上配置java環境,解決Decode error - output not utf-8問題JavaError
- minikube配置代理:解決方案以及解決思路
- 智慧停車場解決方案,反向尋車系統解決方案
- [題解]CF13C Sequence