2016-07-04 14 views
1

Ich versuche, die Spring-Websocket-Abhängigkeit in einer Spring Web App hinzuzufügen.Spring Web-Socket - Kann BeanDefinitionParser für Element nicht finden [Nachrichten-Broker]

Ich habe diese Abhängigkeit in der pom.xml hinzugefügt:

<dependency> 
    <groupId>org.springframework</groupId> 
    <artifactId>spring-websocket</artifactId> 
    <version>4.2.4</version> 
</dependency> 

Und ich habe eine XML-Konfigurations Äquivalent für @EnableWebSocketMessageBroker erstellt, wie hier angegeben:

http://docs.spring.io/spring/docs/current/spring-framework-reference/html/websocket.html#websocket-stomp-enable

Also, ich have this 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> 

Wenn ich die Web-App zu starten, habe ich sofort diesen Fehler:

[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] 

Wie um diesen Fehler zu lösen?

Danke.

Antwort

0

Ich erfahre den gleichen Fehler wie Sie.

Es stellt sich heraus, dass Sie feder Messaging Glas im Klassenpfad, um websocket zu verwenden, benötigen: Message-Broker im xml.

Die Fehlermeldung ist überhaupt nicht hilfreich