首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Spring web套接字-找不到元素[message-broker]的BeanDefinitionParser

Spring web套接字-找不到元素[message-broker]的BeanDefinitionParser
EN

Stack Overflow用户
提问于 2016-07-04 21:07:11
回答 1查看 239关注 0票数 1

我正在尝试在Spring web应用程序中添加spring-websocket依赖项。

我已经在pom.xml中添加了这个依赖项:

代码语言:javascript
复制
<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:

代码语言:javascript
复制
<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时,我立即出现了这个错误:

代码语言:javascript
复制
[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]

如何解决这个错误?

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2016-12-08 19:19:31

我经历了和你一样的错误。

事实证明,为了在spring-messaging中使用websocket:message-broker,您需要在类路径中使用xml。

错误消息没有任何帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38185530

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档