我正在尝试在Spring web应用程序中添加spring-websocket依赖项。
我已经在pom.xml中添加了这个依赖项:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>4.2.4</version>
</dependency>我已经为@EnableWebSocketMessageBroker创建了一个等价的XML配置,如下所示:
http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-enable
所以,我有了这个spring-socket-context.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:websocket="http://www.springframework.org/schema/websocket"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/websocket
http://www.springframework.org/schema/websocket/spring-websocket.xsd">
<websocket:message-broker application-destination-prefix="/app">
<websocket:stomp-endpoint path="/myPath">
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic, /queue"/>
</websocket:message-broker>
</beans>当我启动web-app时,我立即出现了这个错误:
[ERROR] 2016-07-04 14:52:11,381 [] [] org.springframework.web.context.ContextLoader initWebApplicationContext - Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Cannot locate BeanDefinitionParser for element [message-broker]如何解决这个错误?
谢谢。
发布于 2016-12-08 19:19:31
我经历了和你一样的错误。
事实证明,为了在spring-messaging中使用websocket:message-broker,您需要在类路径中使用xml。
错误消息没有任何帮助。
https://stackoverflow.com/questions/38185530
复制相似问题