Tomcat了解amq:broker,但Eclipse标记了架构中的错误

Héc*_*mos 5 java eclipse activemq-classic springsource

在Eclipse中使用ActiveMQ时,有时可能会出现模式解析错误:

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c:
The matching wildcard is strict, but no declaration can be found for element 'amq:broker'.  
Run Code Online (Sandbox Code Playgroud)

但是,该项目在Tomcat中成功部署.

Héc*_*mos 7

要解决此问题,您必须将ActiveMQ XSD URL与架构相关联.

转到首选项中的XML-> XML目录,然后添加用户指定的条目.

Location: http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd
Key Type: Namespace Name
Key: http://activemq.apache.org/schema/core
Run Code Online (Sandbox Code Playgroud)

然后添加第二个:

Location: http://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd
Key Type: Schema Location
Key: http://activemq.apache.org/schema/core/activemq-core.xsd
Run Code Online (Sandbox Code Playgroud)

点击OK.

如果您有相同的错误并且Tomcat失败,请打开applicationContext-jms.xml文件,该文件触发错误并替换:

http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd
Run Code Online (Sandbox Code Playgroud)

http://activemq.apache.org/schema/core/activemq-core.xsd
Run Code Online (Sandbox Code Playgroud)