当我尝试将 Spring JMS 集成到我当前的项目中时,我一直遇到此错误。它让我陷入困境,而且我不完全确定如何解决它,因为我是 Spring 的新手。
The prefix "jms" for element "jms:listener-container" is not bound.
Run Code Online (Sandbox Code Playgroud)
有问题的代码是这样的,
<jms:listener-container container-type="default" connection-factory="connectionFactory" acknowledge="auto">
<jms:listener destination="TESTQUEUE" ref="simpleMessageListener" method="onMessage" />
</jms:listener-container>
Run Code Online (Sandbox Code Playgroud)
我很确定它与 jms: 命名空间有关,但我不知道如何修复它,因为我的程序抱怨 p: 命名空间,所以我必须将其更改为 property name="some value" 引用="一些参考"
确保上下文文件中有 jms 命名空间:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jms="http://www.springframework.org/schema/jms"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.0.xsd">
<!-- <bean/> definitions here -->
</beans>
Run Code Online (Sandbox Code Playgroud)
有关详细信息,请参阅http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/jms.html。