java开发工具错误收集

 java开发工具经常出现一些莫名奇妙的错误信息:

1: White space is required before the encoding pseudo attribute in the XML declaration.

错误出现位置:

<?xml version="1.0"encoding="UTF-8"?>

正确方式:  最后问号的前面需要空格

<?xml version="1.0" encoding="UTF-8" ?>

标签属性之间要有空格.

 

2: 【eclipse】spring的配置文件applicationContext.xml有出现红叉,配置文件如下

<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:jpa="http://www.springframework.org/schema/data/jpa"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
...其他省略
</beans>

从网上搜了一些,有的说是因为网络原因访问不到xsd文件,因为访问不到网络上的xsd文件,我们可以访问本地的啊,在引入的spring的包中spring-beans-4.3.18.RELEASE.jar中有spring-beans-4.3.xsd文件,可以把xsd文件的引用全部改为本地文件:

改为从本地获取这个文件,下面的文件我修改了2出

<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:jpa="http://www.springframework.org/schema/data/jpa"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans classpath:/org/springframework/beans/factory/xml/spring-beans-4.3.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/tx classpath:/org/springframework/transaction/config/spring-tx-4.3.xsd
        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd">
...其他省略
</beans>

 

posted @ 2020-05-16 20:46  南极山  阅读(111)  评论(0)    收藏  举报