Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.03 KB | None | 0 0
  1. Caused by: java.lang.IllegalArgumentException: No handlers
  2. at org.springframework.util.Assert.isTrue(Assert.java:92) ~[spring-core-4.3.9.RELEASE.jar:4.3.9.RELEASE]
  3. at org.springframework.web.socket.messaging.SubProtocolWebSocketHandler.start(SubProtocolWebSocketHandler.java:244) ~[spring-websocket-4.3.9.RELEASE.jar:4.3.9.RELEASE]
  4. at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE]
  5. ... 15 common frames omitted
  6.  
  7. <?xml version="1.0" encoding="UTF-8"?>
  8. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  9. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  10. <modelVersion>4.0.0</modelVersion>
  11.  
  12. <groupId>com.example</groupId>
  13. <artifactId>websocket</artifactId>
  14. <version>0.0.1-SNAPSHOT</version>
  15. <packaging>jar</packaging>
  16.  
  17. <name>websocket</name>
  18. <description>Demo project for Spring Boot</description>
  19.  
  20. <parent>
  21. <groupId>org.springframework.boot</groupId>
  22. <artifactId>spring-boot-starter-parent</artifactId>
  23. <version>1.5.4.RELEASE</version>
  24. <relativePath/> <!-- lookup parent from repository -->
  25. </parent>
  26.  
  27. <properties>
  28. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  29. <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
  30. <java.version>1.8</java.version>
  31. </properties>
  32.  
  33. <dependencies>
  34. <dependency>
  35. <groupId>org.springframework.boot</groupId>
  36. <artifactId>spring-boot-starter-activemq</artifactId>
  37. </dependency>
  38. <dependency>
  39. <groupId>org.springframework.boot</groupId>
  40. <artifactId>spring-boot-starter-web</artifactId>
  41. </dependency>
  42. <dependency>
  43. <groupId>org.springframework.boot</groupId>
  44. <artifactId>spring-boot-starter-websocket</artifactId>
  45. </dependency>
  46. <dependency>
  47. <groupId>org.springframework.boot</groupId>
  48. <artifactId>spring-boot-configuration-processor</artifactId>
  49. </dependency>
  50.  
  51. <dependency>
  52. <groupId>org.apache.activemq</groupId>
  53. <artifactId>activemq-stomp</artifactId>
  54. </dependency>
  55. <dependency>
  56. <groupId>io.projectreactor</groupId>
  57. <artifactId>reactor-net</artifactId>
  58. </dependency>
  59. <dependency>
  60. <groupId>io.projectreactor</groupId>
  61. <artifactId>reactor-core</artifactId>
  62. </dependency>
  63. <dependency>
  64. <groupId>io.netty</groupId>
  65. <artifactId>netty-all</artifactId>
  66. <version>4.1.2.Final</version>
  67. </dependency>
  68.  
  69. <dependency>
  70. <groupId>org.springframework.boot</groupId>
  71. <artifactId>spring-boot-starter-test</artifactId>
  72. <scope>test</scope>
  73. </dependency>
  74. </dependencies>
  75.  
  76. <build>
  77. <plugins>
  78. <plugin>
  79. <groupId>org.springframework.boot</groupId>
  80. <artifactId>spring-boot-maven-plugin</artifactId>
  81. </plugin>
  82. </plugins>
  83. </build>
  84. </project>
  85.  
  86. package com.example.websocket;
  87.  
  88. import org.springframework.boot.SpringApplication;
  89. import org.springframework.boot.autoconfigure.SpringBootApplication;
  90.  
  91. @SpringBootApplication
  92. public class WebsocketApplication {
  93.  
  94. public static void main(String[] args) {
  95. SpringApplication.run(WebsocketApplication.class, args);
  96. }
  97. }
  98.  
  99. package com.example.websocket;
  100.  
  101. import org.springframework.beans.factory.annotation.Value;
  102. import org.springframework.context.annotation.Configuration;
  103. import org.springframework.jms.annotation.EnableJms;
  104. import org.springframework.messaging.simp.config.MessageBrokerRegistry;
  105. import org.springframework.web.socket.config.annotation.EnableWebSocket;
  106. import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
  107. import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
  108. import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport;
  109.  
  110. @Configuration
  111. @EnableWebSocket
  112. @EnableWebSocketMessageBroker
  113. @EnableJms
  114. public class WebSocketConfig extends WebSocketMessageBrokerConfigurationSupport {
  115.  
  116. @Value("${spring.activemq.user}")
  117. private String mqUser;
  118. @Value("${spring.activemq.password}")
  119. private String mqPasword;
  120.  
  121. @Override
  122. public void configureMessageBroker(final MessageBrokerRegistry config) {
  123. config.enableStompBrokerRelay("/topic") //
  124. .setRelayHost("localhost") //
  125. .setRelayPort(61613) //
  126. .setClientLogin(mqUser) //
  127. .setClientPasscode(mqPasword) //
  128. ;
  129. config.setApplicationDestinationPrefixes("/app");
  130. }
  131.  
  132. @Override
  133. public void registerStompEndpoints(final StompEndpointRegistry registry) {
  134. registry.addEndpoint("/websocket").withSockJS();
  135. }
  136.  
  137. }
  138.  
  139. spring:
  140. activemq:
  141. broker-url: stomp://localhost:61613
  142. user: user
  143. password: pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement