配置beans.xml报错

报错内容如下:

Multiple annotations found at this line:
    - cvc-complex-type.2.4.a: Invalid content was found starting with element 'bean'. One of '{"http://xmlns.jcp.org/xml/ns/javaee":interceptors, "http://xmlns.jcp.org/
     xml/ns/javaee":decorators, "http://xmlns.jcp.org/xml/ns/javaee":alternatives, "http://xmlns.jcp.org/xml/ns/javaee":scan, "http://xmlns.jcp.org/xml/ns/javaee":trim}' is 

解决方法:

<?xml version="1.0"?>
<beans bean-discovery-mode="annotated" version="2.0"
 xmlns="http://xmlns.jcp.org/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd" />
将 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 中的www删除,然后保存就可以了

最后说一句,这个错真的是奇葩,找好久,还以为是dtd的问题。。。

猜你喜欢

转载自blog.csdn.net/QQ17680473835/article/details/81806398