我剛剛將版本2.4.4更新至3.0.1。我在應用程序啓動時遇到以下錯誤,我找不到解決方案。我正在使用Weld SE。Weld 3啓動時發出XSD無效beans.xml焊接問題警告:掃描標籤
Sep 15, 2017 1:25:12 PM org.jboss.weld.xml.BeansXmlHandler error
WARN: WELD-001208: Error when validating file:/(...)/META-INF/[email protected] against xsd. cvc-complex-type.2.4.a: Invalid content was found starting with element 'weld:scan'. 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 expected.
的beans.xml
含有焊縫特定標籤以包括在掃描一些類(如僅排除由CDI規範支持)。
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:weld="http://jboss.org/schema/weld/beans"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
<weld:scan>
<weld:include name="com.company.mypackage"/>
(...)
</weld:scan>
</beans>
我使用以下Maven Weld SE依賴項。
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>3.0.1.Final</version>
</dependency>
請問我該怎麼做才能解決這個問題?我檢查了CDI 2.0 XSD,但我還沒有找到任何。也許,CDI本身支持掃描的包含限制?或者也許Weld XSD已經改變了?
我在bug tracker of Weld上創建了一張票,以防萬一它是一個錯誤。
將模式位置添加到XML標頭不起作用 –