GithubHelp home page GithubHelp logo

spring-guides / gs-messaging-stomp-websocket Goto Github PK

View Code? Open in Web Editor NEW
514.0 514.0 471.0 6.2 MB

Using WebSocket to build an interactive web application :: Learn how to the send and receive messages between a browser and the server over a WebSocket

Home Page: http://spring.io/guides/gs/messaging-stomp-websocket/

License: Apache License 2.0

Java 58.51% HTML 19.27% JavaScript 13.83% Shell 3.45% CSS 4.94%

gs-messaging-stomp-websocket's People

Contributors

bclozel avatar bluishoul avatar btalbott avatar buzzardo avatar cbeams avatar gregturn avatar habuma avatar marciopd avatar oncethor avatar robertmcnees avatar royclarkson avatar rsparkyc avatar rstoyanchev avatar sdeleuze avatar spring-operator avatar tsuyo avatar yujunhao8831 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gs-messaging-stomp-websocket's Issues

Upgrade to latest stomp.js and correct example on how to connect

Apparently the latest stomp.js (version 2.3) does not allow empty login/passcode values. Instead we need to call the connect variant that accepts an (empty) map of headers.

In other words this:

stompClient.connect({}, function(frame) {

}

Instead of this:

stompClient.connect('', '', function(frame) {

}

This was originally reported in Spring's JIRA as a documentation issue but actually referenced this guide. See https://jira.springsource.org/browse/SPR-11436.

Whoops! Lost connection to undefined

This problem is turning out to be my nemesis. So I did implemented Spring web sockets into an application, following the instructions mentioned here,
https://github.com/rstoyanchev/spring-websocket-portfolio

So when I first tried to run the app using the embedded tomcat that came along with Spring boot it worked fine. Then started the litany of problems. So I tried to the run the application inside a local instance of Tomcat. The moment I click the connect button, it would try to access,

http://localhost:8080/my-project-root/info
and end up with
Whoops! Lost connection to undefined

I managed to resolve the issue by adding the following to my gradle.build

providedCompile "javax.servlet:servlet-api:2.5"
    compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'

And the following to my Application.Java class

public class Application extends SpringBootServletInitializer {

    public static void main(String[] args) {
        SpringApplication.run(applicationClass, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(applicationClass);
    }


    private static Class<Application> applicationClass = Application.class;
}

Now I want to deploy a war file on my local Tomcat instance. So i ran gradlew build on the command line and created a war and copied this to the webapps directory of my tomcat instance.
Now when  I start tomcat and open up the default page and click connect I'm back to the same problem.
` http://localhost:8080/my-project-root/info`
`Whoops! Lost connection to undefined`
 I'd really appreciate some help with this. Also understand what am I doing wrong/not doing with the configuration that's causing this.

jquery webjars is broken again

Looks like somebody overwrote the git history of the master branch, removing the already merged pull request which was fixing this.
See PR "Fixing jquery webjars version #59". What happened to that commit?

Not able to configure Stomp and SockJS endpoint in Spring MVC.Connection issue !!!

I am implementing Notification System. And want to initialize Socket connection when user Logged In, and show him his notifications, and also if some event happens.

My Code snippet as follows.

websocket.js :

var stompClient = null;
function connect( temp ) {
    alert(temp);
    //var socket = new SockJS("/websock");
    //var socket = new SockJS("/websock"+temp);
    var socket = new SockJS(context_path+"/websock"+temp);
    //context_path == "/SupportCenter"
    stompClient = Stomp.over(socket);
    stompClient.connect({}, function( frame ){
        console.log( "Connected :- "+frame );
        stompClient.subscribe("/topic/notifications", function( notifications ) {
            alert( notifications );
        });
    }, function( error ) {
        alert( error );
    });
    alert();
    getNotifications();
}

function getNotifications() {
    stompClient.send("/app/hello", {}, "Hiiiiii");
}

WebSocketConfig.java :

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

    @Override
    public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry) {
        stompEndpointRegistry.addEndpoint("/websock").withSockJS();
    }
    @Override
    public void configureMessageBroker(MessageBrokerRegistry config) {
        // TODO Auto-generated method stub
        config.enableSimpleBroker("/topic");
        config.setApplicationDestinationPrefixes("/app");
    }
}

WebSocketController.java :

@Controller
public class WebSocketController {

    @MessageMapping(value="/hello")
    @SendTo("/topic/notifications")
    public Notify hello() {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        Notify notify = new Notify();
        notify.setMessage("Hello World !!!");
        return notify;
    }
}

Some code Hom.jsp :

<script type="text/javascript" src="<c:url value="/resources/js/sockjs.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/stomp.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/resources/js/websocket.js"/>"></script>


<script type="text/javascript">
$(document).ready(function() {
    //...

    connect( '${nsec}');
});

Why
Firefox Console giving XML Parsing Error: no root element found Location:
while in Network tab status code is 200 OK. ?

What is the cause for this, any suggestions?

Versions I'm using
Spring-MVC - 4.1.6
STOMP - 1.7.1
SockJS-client - 1.1.4

Console TAB
websocket_connection_error6

Network TAB
websocket_connection_error5

Example Does Not Work in Chrome

I have imported the project into SPS by going File -> New -> Import Spring Getting Started Project. The sample does work in Firefox, but not in Chrome. For fun, I tried using the latest version of sockjs (1.0.3), but it does not work in FF or Chrome.

In sockjs 0.3.4, it failed on line 807
GET http://localhost:8080/hello/info 403 (Forbidden)AbstractXHRObject._start @ sockjs-0.3.4.js:807(anonymous function) @ sockjs-0.3.4.js:841
stomp.js:130 Whoops! Lost connection to undefined

Any help would be appreciated.

bug in guide

Hi, I find there is a bug in guide "https://spring.io/guides/gs/messaging-stomp-websocket/#initial",
I choose to download the repository, and then follow doc to "Jump ahead to Create a Resource Representation Class.", however the repository does not include the "pom.xml" with modifications on dependencies. So maybe the guide should be modified to "Jump ahead to Starting with Spring Initializr."
image

example to configure mutual authentication Client

you can have an example to configure a client / server web socket with mutual authentication in ssl?

I try this but i use jetty on spring boot... is corrected?

@Service
@Slf4j
public class StompClient {

    private final String LOG = "[StompClient] --> ";

    @Value("${web-socket.server.endpoint}")
    private String URL;

    private int numberOfConnections;

    private WebSocketStompClient stompClient;

    private StompSession stompSession;
    private Map<String, StompSession> stompSessionMap = new HashMap<>();


    private MutualAuthConfiguration mutualAuthConfiguration;


    @Autowired
    @Qualifier("MyStompSessionHandler")
    private StompSessionHandler sessionHandler;

    @Autowired
    public StompClient(MutualAuthConfiguration mutualAuthConfiguration) throws GeneralSecurityException, IOException {
        this.mutualAuthConfiguration = mutualAuthConfiguration;


        SSLContext sslContext = new SSLContextBuilder()
                .loadTrustMaterial(mutualAuthConfiguration.getTrustStore().getURL(), mutualAuthConfiguration.getTrustStorePassword().toCharArray())
                .loadKeyMaterial(mutualAuthConfiguration.getKeyStore().getURL(), mutualAuthConfiguration.getKeyStorePassword().toCharArray(), mutualAuthConfiguration.getKeyPassword().toCharArray())
                .build();

        StandardWebSocketClient wsClient = new StandardWebSocketClient();

        log.info("--->>> userProperties: {}",wsClient.getUserProperties());
      //FIXME is OK? i don't find correct properties for jetty.
        wsClient.getUserProperties().put("org.eclipse.jetty.server.SslConnectionFactory", sslContext);


        List<Transport> transports = new ArrayList<>(2);
        transports.add(new WebSocketTransport(wsClient));

        transports.add(new RestTemplateXhrTransport());

        WebSocketClient client = new SockJsClient(transports);

        stompClient = new WebSocketStompClient(client);
        stompClient.setMessageConverter(new MappingJackson2MessageConverter());
    }
....
....

Error creating bean with name 'stompWebSocketHandlerMapping

Hi Team,
I just clones the project but it is not working. I'm using Java8, Windows 10, STS.

Error when starting project:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stompWebSocketHandlerMapping' defined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'stompWebSocketHandlerMapping' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/context/support/WebApplicationObjectSupport
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1173) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1067) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [spring-boot-1.5.10.RELEASE.jar:1.5.10.RELEASE]
at hello.Application.main(Application.java:10) [classes/:na]
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.web.servlet.HandlerMapping]: Factory method 'stompWebSocketHandlerMapping' threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/web/context/support/WebApplicationObjectSupport
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.3.14.RELEASE.jar:4.3.14.RELEASE]
... 17 common frames omitted
Caused by: java.lang.NoClassDefFoundError: org/springframework/web/context/support/WebApplicationObjectSupport

Also, Compiler error: GreetingIntegrationTests.java
Line: 94-> this.stompClient.connect("ws://localhost:{port}/gs-guide-websocket", this.headers, handler, this.port)

Compiler error: The type org.springframework.http.HttpHeaders cannot be resolved. It is indirectly referenced from required .class files

I checked and found that HttpHeaders is missing in

org.springframework
spring-web
4.3.14.RELEASE

Please help if im doing anything wrong

How to set property of the broker such like RabbitMQ?

Hello, I just changed the broker setting to enable my RabbitMQ server works.
(I changed the ""enableSimpleBroker" to "enableStompBrokerRelay" so that RabbitMQ can work in my localhost:15672)

I am wondering that what should I do if I want to send a message to another PC in the same LAN rather than sending to my local port?
I guess I might add a java code to set some property with AMQP protocol, but I am not sure how to do that.

thanks for any help or suggestion!

Consider showing reconnect logic on the client side

This from a ticket originally created in the Spring Framework JIRA (see SPR-11732):

The current websocket guide don't show how to reconnect if the connection is lost.
This is critical functionality of any websocket application and should be shown in the guide.

CROS origin issue

Websocket with stomp sock js accessing through spring cloud gateway . two rest API service and websocket ,so total three is routed through gateway. rest API working fine but websocket showing below error. Also I have implemented cross filters for cross origin .
Access to XMLHttpRequest at 'http://localhost:8085/websocket/live-mine/info?t=1593887703692' from origin 'http://localhost:8080' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values 'http://localhost:8080, http://localhost:8080', but only one is allowed.

Error creating bean while trying Gradle bootRun

This is the stacktrace of my error. Is it related to the fact that I'm currently inside a proxied intranet?

PS C:\Users\mbresciani\Desktop\Spring\Guides\Using WebSocket to build an interactive web application> & 'C:\Program File
s (x86)\gradle-2.0\bin\gradle.bat' bootRun --stacktrace
:compileJava UP-TO-DATE
:processResources
:classes
:findMainClass
:bootRun

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.1.5.RELEASE)

2014-08-28 13:58:35.259  INFO 5876 --- [           main] hello.Application                        : Starting Application
 on L-IT-05839 with PID 5876 (started by MBresciani in C:\Users\mbresciani\Desktop\Spring\Guides\Using WebSocket to buil
d an interactive web application)
2014-08-28 13:58:35.296  INFO 5876 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.sprin
gframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@4963f7a1: startup date [Thu Aug 28 13:58:
35 CEST 2014]; root of context hierarchy
2014-08-28 13:58:35.936  INFO 5876 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean defi
nition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; auto
wireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfi
gure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodN
ame=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/Error
MvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; laz
yInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframewo
rk.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver
; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfig
ure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
2014-08-28 13:58:36.794  INFO 5876 --- [           main] .t.TomcatEmbeddedServletContainerFactory : Server initialized w
ith port: 8080
2014-08-28 13:58:36.996  INFO 5876 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tom
cat
2014-08-28 13:58:36.997  INFO 5876 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Eng
ine: Apache Tomcat/7.0.54
2014-08-28 13:58:37.084  INFO 5876 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring
embedded WebApplicationContext
2014-08-28 13:58:37.084  INFO 5876 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationC
ontext: initialization completed in 1791 ms
2014-08-28 13:58:37.543  INFO 5876 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'di
spatcherServlet' to [/]
2014-08-28 13:58:37.546  INFO 5876 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hid
denHttpMethodFilter' to: [/*]
2014-08-28 13:58:37.749  INFO 5876 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing Executo
rService  'clientInboundChannelExecutor'
2014-08-28 13:58:37.758  INFO 5876 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing Executo
rService  'clientOutboundChannelExecutor'
2014-08-28 13:58:37.776  INFO 5876 --- [           main] o.s.s.c.ThreadPoolTaskScheduler          : Initializing Executo
rService  'messageBrokerSockJsTaskScheduler'
2014-08-28 13:58:37.779  INFO 5876 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down Execut
orService 'clientOutboundChannelExecutor'
2014-08-28 13:58:37.779  INFO 5876 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down Execut
orService 'clientInboundChannelExecutor'
2014-08-28 13:58:37.782  INFO 5876 --- [           main] o.apache.catalina.core.StandardService   : Stopping service Tom
cat
2014-08-28 13:58:37.794  INFO 5876 --- [           main] .b.l.ClasspathLoggingApplicationListener : Application failed t
o start with classpath: [file:/C:/Users/mbresciani/Desktop/Spring/Guides/Using%20WebSocket%20to%20build%20an%20interacti
ve%20web%20application/src/main/resources/, file:/C:/Users/mbresciani/Desktop/Spring/Guides/Using%20WebSocket%20to%20bui
ld%20an%20interactive%20web%20application/build/classes/main/, file:/C:/Users/mbresciani/Desktop/Spring/Guides/Using%20W
ebSocket%20to%20build%20an%20interactive%20web%20application/build/resources/main/, file:/C:/Users/mbresciani/.m2/reposi
tory/org/springframework/boot/spring-boot-starter-websocket/1.1.5.RELEASE/spring-boot-starter-websocket-1.1.5.RELEASE.ja
r, file:/C:/Users/mbresciani/.m2/repository/org/springframework/spring-messaging/4.0.6.RELEASE/spring-messaging-4.0.6.RE
LEASE.jar, file:/C:/Users/mbresciani/.m2/repository/org/springframework/boot/spring-boot-starter/1.1.5.RELEASE/spring-bo
ot-starter-1.1.5.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/org/springframework/boot/spring-boot-starter-web/
1.1.5.RELEASE/spring-boot-starter-web-1.1.5.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/org/springframework/sp
ring-core/4.0.6.RELEASE/spring-core-4.0.6.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/org/springframework/spri
ng-websocket/4.0.6.RELEASE/spring-websocket-4.0.6.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/org/apache/tomca
t/embed/tomcat-embed-websocket/7.0.54/tomcat-embed-websocket-7.0.54.jar, file:/C:/Users/mbresciani/.m2/repository/org/sp
ringframework/spring-beans/4.0.6.RELEASE/spring-beans-4.0.6.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/org/sp
ringframework/spring-context/4.0.6.RELEASE/spring-context-4.0.6.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/or
g/springframework/boot/spring-boot/1.1.5.RELEASE/spring-boot-1.1.5.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository
/org/springframework/boot/spring-boot-autoconfigure/1.1.5.RELEASE/spring-boot-autoconfigure-1.1.5.RELEASE.jar, file:/C:/
Users/mb                                                                                                               r
esciani/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.1.5.RELEASE/spring-boot-starter-logging-1.
1.5.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/org/yaml/snakeyaml/1.13/snakeyaml-1.13.jar, file:/C:/Users/mbr
esciani/.m2/repository/org/springframework/boot/spring-boot-starter-tomcat/1.1.5.RELEASE/spring-boot-starter-tomcat-1.1.
5.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/com/fasterxml/jackson/core/jackson-databind/2.3.3/jackson-databi
nd-2.3.3.jar, file:/C:/Users/mbresciani/.m2/repository/org/hibernate/hibernate-validator/5.0.3.Final/hibernate-validator
-5.0.3.Final.jar, file:/C:/Users/mbresciani/.m2/repository/org/springframework/spring-web/4.0.6.RELEASE/spring-web-4.0.6
.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/org/springframework/spring-webmvc/4.0.6.RELEASE/spring-webmvc-4.0
.6.RELEASE.jar, file:/C:/Users/mbresciani/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
, file:/C:/Users/mbresciani/.m2/repository/org/apache/tomcat/embed/tomcat-embed-core/7.0.54/tomcat-embed-core-7.0.54.jar
, file:/C:/Users/mbresciani/.m2/repository/org/springframework/spring-aop/4.0.6.RELEASE/spring-aop-4.0.6.RELEASE.jar, fi
le:/C:/Users/mbresciani/.m2/repository/org/springframework/spring-expression/4.0.6.RELEASE/spring-expression-4.0.6.RELEA
SE.jar, file:/C:/Users/mbresciani/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.7/jcl-over-slf4j-1.7.7.jar, file:/C:/Users
/mbresciani/.m2/repository/org/slf4j/jul-to-slf4j/1.7.7/jul-to-slf4j-1.7.7.jar, file:/C:/Users/mbresciani/.m2/repository
/org/slf4j/log4j-over-slf4j/1.7.7/log4j-over-slf4j-1.7.7.jar, file:/C:/Users/mbresciani/.m2/repository/ch/qos/logback/lo
gback-classic/1.1.2/logback-classic-1.1.2.jar, file:/C:/Users/mbresciani/.m2/repository/org/apache/tomcat/embed/tomcat-e
mbed-el/7.0.54/tomcat-embed-el-7.0.54.jar, file:/C:/Users/mbresciani/.m2/repository/org/apache/tomcat/embed/tomcat-embed
-logging-juli/7.0.54/tomcat-embed-logging-juli-7.0.54.jar, file:/C:/Users/mbresciani/.gradle/caches/modules-2/files-2.1/
com.fas                                                                                                                t
erxml.jackson.core/jackson-annotations/2.3.0/f5e853a20b60758922453d56f9ae1e64af5cb3da/jackson-annotations-2.3.0.jar, fil
e:/C:/Users/mbresciani/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.3.3/jackson-core-2.3.3.jar, file:/C:/Use
rs/mbresciani/.m2/repository/javax/validation/validation-api/1.1.0.Final/validation-api-1.1.0.Final.jar, file:/C:/Users/
mbresciani/.m2/repository/org/jboss/logging/jboss-logging/3.1.1.GA/jboss-logging-3.1.1.GA.jar, file:/C:/Users/mbresciani
/.m2/repository/com/fasterxml/classmate/1.0.0/classmate-1.0.0.jar, file:/C:/Users/mbresciani/.m2/repository/aopalliance/
aopalliance/1.0/aopalliance-1.0.jar, file:/C:/Users/mbresciani/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.
jar, file:/C:/Users/mbresciani/.m2/repository/ch/qos/logback/logback-core/1.1.2/logback-core-1.1.2.jar]
2014-08-28 13:58:37.795  INFO 5876 --- [           main] utoConfigurationReportLoggingInitializer :

Error starting ApplicationContext. To display the auto-configuration report enabled debug logging (start with --debug)


Exception in thread "main" 2014-08-28 13:58:37.804 ERROR 5876 --- [           main] o.s.boot.SpringApplication
     : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stompWebSocketHandlerMapping' de
fined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfigura
tion.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreExce
ption: Factory method [public org.springframework.web.servlet.HandlerMapping org.springframework.web.socket.config.annot
ation.WebSocketMessageBrokerConfigurationSupport.stompWebSocketHandlerMapping()] threw exception; nested exception is or
g.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageBrokerSockJsTaskScheduler'
defined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfigu
ration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: java.util.concurrent.S
cheduledThreadPoolExecutor.setRemoveOnCancelPolicy(Z)V

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stompWebSocketHandlerMapping' de
fined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfigura
tion.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreExce
ption: Factory method [public org.springframework.web.servlet.HandlerMapping org.springframework.web.socket.config.annot
ation.WebSocketMessageBrokerConfigurationSupport.stompWebSocketHandlerMapping()] threw exception; nested exception is or
g.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageBrokerSockJsTaskScheduler'
defined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfigu
ration.class]: Invocation of
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:
597)
 init method failed; nested exception is java.lang.NoSuchMethodError: java.util.concurrent.ScheduledThreadPoolExecutor.s
etRemoveOnCancelPolicy(Z)V
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(Ab
stractAutowireCapableBeanFactory.java:1094)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolv
er.java:597)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutow
ireCapableBeanFactory.java:989)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(Ab
stractAutowireCapableBeanFactory.java:1094)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:504)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapab
leBeanFactory.java:989)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:504)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:475)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:475)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:228)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:228)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.ja at org.springfra
mework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListable
BeanFactory.java:703)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListable
BeanFactory.java:703)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplic
ationContext.java:760)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplic
ationContext.java:760)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext
.java:120)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext
.java:120)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:691)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:952)
        at org.springframework.boot.SpringApplication.run(SpringApp     at org.springframework.boot.SpringApplication.ru
n(SpringApplication.java:941)
n.java:952)
        at hello.Application.main(Application.java:12)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:941)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.we
b.servlet.HandlerMapping org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport.sto
mpWebSocketHandlerMapping()] threw exception; nested exception is org.springframework.beans.factory.BeanCreationExceptio
n: Error creating bean with name 'messageBrokerSockJsTaskScheduler' defined in class path resource [org/springframework/
web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class]: Invocation of init method failed; nes
ted exception is java.lang.NoSuchMethodError: java.util.concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(Z
)V
at hello.Application.main(Application.java:12)

Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.we
b.servlet.HandlerMapping org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport.sto
mpWebSocketHandlerMapping()] threw exception; nested exception is org.springframework.beans.factory.BeanCreationExceptio
n: Error creating bean with name 'messageBrokerSockJsTaskScheduler' defined in class path resource [org/springframework/
web/socket/config/annotation/DelegatingWebSocketMessageBrokerConfiguration.class]: Invocation of init method failed; nes
ted exception is java.lang.NoSuchMethodError: java.util.concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(Z
)V
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
.java:188)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
.java:188)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolv
er.java:586)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolv
er.java:586)
        ... 17 more
        ... 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageBrokerSockJsTa
skScheduler' defined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessage
BrokerConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: java.util
.concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(Z)V                                                    C
aused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageBrokerSockJsTas
kScheduler' defined in class path resource [org/springframework/web/socket/config/annotation/DelegatingWebSocketMessageB
rokerConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: java.util.
concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(Z)V

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1553)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1553)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:539)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCap
ableBeanFactory.java:539)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:475)
        at org.springframework.beans.factory.supptractBeanFactory$1.getObject(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:228)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapab
leBeanFactory.java:475)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.ja     at org.s
pringframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.
java:324)

        at org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration$$EnhancerBySpr
ingCGLIB$$76f0ab75.messageBrokerSockJsTaskScheduler(<generated>)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegis
try.java:228)
        at org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport.stompWebSocketHan
dlerMapping(WebSocketMessageBrokerConfigurationSupport.java:49)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)
        at org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration$$EnhancerBySpr
ingCGLIB$$76f0ab75.CGLIB$stompWebSocketHandlerMapping$7(<generated>)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration$$EnhancerBySpr
ingCGLIB$$76f0ab75$$FastClassBySpringCGLIB$$cef8b633.invoke(<generated>)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(Configurati
onClassEnhancer.java:324)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration$$EnhancerBySpr
ingCGLIB$$76f0ab75.messageBrokerSockJsTaskScheduler(<generated>)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassE
nhancer.java:312)

        at org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration$$EnhancerBySpr
ingCGLIB$$76f0ab75.stompWebSocketHandlerMapping(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurationSupport.stompWebSocketHan
dlerMapping(WebSocketMessageBrokerConfigurationSupport.java:49)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration$$EnhancerBySpr
ingCGLIB$$76f0ab75.CGLIB$stompWebSocketHandlerMapping$7(<generated>)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration$$EnhancerBySpr
ingCGLIB$$76f0ab75$$FastClassBySpringCGLIB$$cef8b633.invoke(<generated>)
at java.lang.reflect.Method.invoke(Method.java:597)

        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantia      at org.springframework.c
glib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(Configurati
onClassEnhancer.java:312)
leInstantiationStrategy.java:166)
        at org.springframework.web.socket.config.annotation.DelegatingWebSocketMessageBrokerConfiguration$$EnhancerBySpr
ingCGLIB$$76f0ab75.stompWebSocketHandlerMapping(<generated>)
        ... 18 common frames omitted
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Caused by: java.lang.NoSuchMethodError: java.util.concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(Z)V
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.j       at org.springframework.schedulin
g.concurrent.ThreadPoolTaskScheduler.initializeExecutor(ThreadPoolTaskScheduler.java:108)

        at org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.initialize(ExecutorConfigurationSuppor
t.java:170)
        at org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.afterPropertiesSet(ExecutorConfigurati
onSupport.java:157)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowi
reCapableBeanFactory.java:1612)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1549)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy
.java:166)
        ... 37 common frames omitted
        ... 18 more

Caused by: java.lang.NoSuchMethodError: java.util.concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(Z)V
        at org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler.initializeExecutor(ThreadPoolTaskScheduler.
java:108)
        at org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.initialize(ExecutorConfigurationSuppor
t.java:170)
        at org.springframework.scheduling.concurrent.ExecutorConfigurationSupport.afterPropertiesSet(ExecutorConfigurati
onSupport.java:157)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowi
reCapableBeanFactory.java:1612)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireC
apableBeanFactory.java:1549)
        ... 37 more
:bootRun FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':bootRun'.
> Process 'command 'C:\Program Files\Java\jdk1.6.0_21\bin\java.exe'' finished with non-zero exit value 1

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':bootRun'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.
java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46
)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskEx
ecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExec
uter.java:42)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.j
ava:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.j
ava:43)
        at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:296)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecut
or.java:79)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecut
or.java:63)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:
51)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:86)
        at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
        at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
        at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:67)
        at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:61)
        at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:54)
        at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:148)
        at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:105)
        at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:85)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter
.java:81)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
        at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:39)
        at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:29)
        at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:50)
        at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:23
7)
        at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:21
0)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
        at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
        at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
        at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
        at org.gradle.launcher.Main.doAction(Main.java:33)
        at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
        at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
        at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
Caused by: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.6.0_21\bin\java.exe''
 finished with non-zero exit value 1
        at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365
)
        at org.gradle.process.internal.DefaultJavaExecAction.execute(DefaultJavaExecAction.java:31)
        at org.gradle.api.tasks.JavaExec.exec(JavaExec.java:60)
        at org.springframework.boot.gradle.run.BootRunTask.exec(BootRunTask.java:56)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(Anno
tationProcessingTaskFactory.java:218)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(Annota
tionProcessingTaskFactory.java:211)
        at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(Annota
tionProcessingTaskFactory.java:200)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:570)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:553)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.j
ava:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.
java:61)
        ... 44 more


BUILD FAILED

Total time: 9.336 secs

Use Tomcat 7.0.47 or higher

Currently the guide uses Tomcat 7.0.42 which does not support JSR-356 and leads to an IllegalStateException and message about no suitable RequestUpgradeStrategy being available.

Undefined value in connect() function

Problem.
Following the guide, I got a undefined value for the expected greeting upon been connected to the websocket service. Debugging I have found that it is a problem in the connect() function of the app.js file, in the next line,

22: showGreeting(JSON.parse(greeting.body).content);

Solution that works for me.
Using the property to be displayed and also the one that is coming as a json property, which it is "greeting", in the connect() function, solve the problem for me:

showGreeting(JSON.parse(greeting.body).greeting);

If there is any other explanation about this, or in case of any comment, please let me know.

Allowed origins

Didn't work for me without additional permission.
I launched the front using "Live Server" in VS Code on 5500 port.
I had to add the line .setAllowedOrigins("http://127.0.0.1:5500/") to make it work.

@Override
	public void registerStompEndpoints(StompEndpointRegistry registry) {
		registry.addEndpoint("/gs-guide-websocket")
				.setAllowedOrigins("http://127.0.0.1:5500/");//I added it
	}

Confused

Trying to learn stomp. The example uses /hello both as an endpoint and as a MessageMapping. I understand them to be different things.

Error parsing pom.xml

Description Resource Path Location Type
Error parsing lifecycle processing instructions pom.xml /gs-messaging-stomp-websocket line 1 Maven Project Build Lifecycle Mapping Problem
无标题

Why create a new TCP connection to MQ for each JS client?

We build an application like webchat, use ActiveMQ as the broker, when one browser client connect to chat server, we find that a new TCP connection for MQ, so if we want to support millions client, it may create too many connections for MQ, can we reuse the connection between chat server and MQ?

Can't connect to WebSocket - Gives me 404 not found for /hello/info

I want to test out the SockJS-WebSocket messaging as described here but each time I clicked on the connect button, I kept on getting the frustrating error

GET http://localhost:8080/myapp/hello/info 404 (not found). Whoops! Lost connection to undefined

I thought I must be doing something wrong, but I followed the steps to the T.

Finally, I downloaded the gs-messaging-stomp-websocket directory from the tutorial here, went to complete directory where all the files are, and launched it with mvn spring-boot:run. It launched normally. I went to http://localhost:8080 and clicked on the connect button again, and I got the same frustrating error as above. This time, I didn't change a single thing about the configuration or the code.

I tried to troubleshoot using some of the Stack Overflow threads here, here and here and unfortunately, I hit a wall as none of the suggested solutions work for me.

So please help me and let me know what I am doing wrong, and how to solve this issue.

Caused by: java.lang.NoClassDefFoundError: org/springframework/web/socket/client/WebSocketClient

Please help me.

@EnableWebSocketMessageBroker
@Service
public class QuotesSocket {

    @Value("${app.quotes.socket.url}")
    private String url;
    private Logger logger = LogManager.getLogger(QuotesStompSessionHandler.class);

    WebSocketStompClient webSocketStompClient;

    @PostConstruct
    public void connect() {
        WebSocketClient client = new StandardWebSocketClient();
        webSocketStompClient = new WebSocketStompClient(client);
        webSocketStompClient.setMessageConverter(new MappingJackson2MessageConverter());
        StompSessionHandler sessionHandler = new QuotesStompSessionHandler();
        webSocketStompClient.connect(url, sessionHandler);

        new Scanner(System.in).nextLine();
    }
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {

    @Override
    public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {

    }

}

Changing return from HelloMessage to String in Test fails

I know this is not a problem with the code but I am interested to know the answer.
I have replaced the use of both Greeting and HelloMessage POJO's with String.
This works except for the unit test (so I skipTests).
The problem appears to be in getPayLoadType in GreetingIntegrationTests.java.
Here is the code change

					public Type getPayloadType(StompHeaders headers) {
						System.out.println("DEBUG: into getPayloadType");
						return String.class;
					}

Output shows the debug message but no return. Which means that it times out

		if (latch.await(3, TimeUnit.SECONDS)) {
			if (failure.get() != null) {
				throw new AssertionError("", failure.get());
			}
		}
		else {
			fail("DEBUG: Greeting not received");
		}

and the not received message is received.
So code changes in the actual code is correct but I have made mistakes in the integation test code.
Any ideas?
Regards,

convertAndSendToUser not work

messagingTemplate.convertAndSendToUser(headerAccessor.getSessionId(),"/user/queue/greetings", new Greeting("Hello, " + HtmlUtils.htmlEscape(headerAccessor.getSessionId()) + "!"));

stompClient.subscribe('/user/queue/greetings', function (greeting) { showGreeting(JSON.parse(greeting.body).content); });

add @SendToUser demo

I think it will be better to add a demo describe how to use @SendToUser. It will meet the needs of more people.

cannot send data correctly

hello, I am new to this project. I tried to change the "name" to "name1" in the code from send() function in index.html and HelloMessage as follow, but it doesn't work.I am wondering how the GreetingController receive the "name" JSON data?

my code are as follow:

  1. send() in index.html

function send () {
var name = document.getElementById('name').value;
client_1.send("/app/sock1",{}, JSON.stringify({ 'name1': name }));
}

2.HelloMessage.java

package demo;

public class HelloMessage {

private String name1;

public String getName() {
    return name1;
}

}

I also met a problem that I cannot find where the "getContent()" be used in this project?
I tried to rename the function as "getsomething". It can be runned, but showing undefined output.
Where will the project call this function?

please help me with these two problems, I will be very grateful! thank you!

Change the guide's title to be task-focused

The current title "Messaging with STOMP over WebSocket" is an accurate description. However, one of the major benefits of the GS guides is their task-focused nature. Fro that perspective I'd like to propose a change.

If we take a step back from the specifics of the technical solution, I believe the task of interest is adding real-time behavior to web applications, or more specifically using WebSocket to add real-time behavior to browser applications. I believe this is a much more instantly appealing topic that also passes the "would anyone google this?" test.

Following that line of thinking, the opening paragraph is too much of a leap:

This guide walks you through the process of creating a "hello world" STOMP messaging server with Spring.

A natural reaction would be: wait a minute, you haven't told me what STOMP is and why it is relevant to me.

Indeed the guide cannot afford to make long explanations, but we can keep the introduction relatively short and simple, yet meaningful. I've explained it enough many times by now in talks and presentations and I believe this line of reasoning resonates reasonably well:

=> websocket is a standard for two-way client-server communication over the web

=> it's great but you need fallback options (IE 7/8/9) and its too-level...

=> it's comparable to using the Servlet API (custom Servlet app anyone?)

=> except it's even lower level than that -- while Servlet API is built on HTTP (an application-level protocol over TCP), the WebSocket protocol is a very thin layer above TCP -- a stream of bytes broken down into messages and what's in these messages is entirely up to you

=> this is why WebSocket defines the use of sub-protocols (i.e. higher-level protocols) on top

=> STOMP is a great match, a simple messaging protocol (frames inspired by HTTP), widely used and supported

=> etc.

I'm happy to help refine and distill this.

This is confusing

Hi,

Sorry to bother you, but I wanted to give you some feedback. As a noob, the whole tutorial feels rather contrived and far from trivial. Here are a few suggestions how it could be made more "friendlier".

First, emphasize that it's not raw websockets, but "STOMP" over websockets. Most of us never heard of STOMP. At least a brief introduction of how STOMP works should be provided ...and it would be nice to now if raw websockets are possible.

Secondly, the whole is written upside down. You first write controllers, topic subscriptions, message brokers, endpoints, application destination prefix (do we really need that one?!) without really understanding why, and it's just confusing.

Here as well, an introduction should first be provided. An overview about the flow and the pupose of each "thing", before diving into the code. Ideally with a nice picture, to help understand how it all fits together.

Lastly, the HTML / js example is bloated, the only thing you need would be something like:

<body>
    <button id="connect" onclick="connect()">Connect</button>
    <button id="disconnect" onclick="disconnect()" disabled>Disconnect</button>
    <hr/>
    What is your name? <input id="name" /><button onclick="sendName()">Send</button>
    <hr/>
    <pre id="greetings"></pre>
</body>

Best Regards

Example does not work out of the box

The example does not work without adding CORS.

The following line is not correct:
registry.addEndpoint("...");

It should be, e.g.:
registry.addEndpoint("...").setAllowedOrigins("*")

Can't connect to WebSocket - Gives me 404 not found for /hello/info

I want to test out the SockJS-WebSocket messaging as described here but each time I clicked on the connect button, I kept on getting the frustrating error

GET http://localhost:8080/myapp/hello/info 404 (not found). Whoops! Lost connection to undefined

I thought I must be doing something wrong, but I followed the steps

Finally, I downloaded the gs-messaging-stomp-websocket directory from the tutorial here, went to complete directory where all the files are, and launched it with mvn spring-boot:run. It launched normally. I went to http://localhost:8080 and clicked on the connect button again, and I got the same frustrating error as above. This time, I didn't change a single thing about the configuration or the code.

So please help me and let me know what I am doing wrong, and how to solve this issue.

copied from : #19 as i'm also facing same issue

Stomp client fails to connect to a dynamic controller destination that has a @DestinationVariable when I switch to use a StompBrokerRelay but it works with SimpleBroker

Hi

When I switch the default config example in the project gs-messaging-stomp-websocket to use config.enableStompBrokerRelay("/topic"); the example works as when I had config.enableSimpleBroker("/topic");.

When I change the controller to use dynamic destinations with a SimpleBroker as below, it also works:

@MessageMapping("/hello/{id}")
@SendTo("/topic/greetings/{id}")
 public Greeting greeting(HelloMessage message, @DestinationVariable String id) throws Exception {
      Thread.sleep(1000); // simulated delay
      return new Greeting("Hello, " + message.getName() + " and id passed is " + id);
 }

But if I change the configuration to use Stomp broker with the above controller, my server app logs say:

2017-04-19 00:26:08.354 ERROR 14958 --- [eactor-tcp-io-3] o.s.m.s.s.StompBrokerRelayMessageHandler : Received ERROR {message=[Invalid destination], content-type=[text/plain], version=[1.0,1.1,1.2], content-length=[48]} session=uxmho5lj text/plain payload='/greetings/1' is not a valid topic destination

and the stomp client say:

Opening Web Socket...
stomp.min.js:8 Web Socket Opened...
stomp.min.js:8 >>> CONNECT
cool:something
accept-version:1.1,1.0
heart-beat:10000,10000


stomp.min.js:8 <<< PONG
stomp.min.js:8 <<< CONNECTED
session:session-kN6B9Jl7qyqx-lNHslTsPA
heart-beat:10000,10000
server:RabbitMQ/3.5.7
version:1.1


stomp.min.js:8 connected to server RabbitMQ/3.5.7
stomp.min.js:8 send PING every 10000ms
stomp.min.js:8 check PONG every 10000ms
app.js:20 Connected: CONNECTED
version:1.1
server:RabbitMQ/3.5.7
heart-beat:10000,10000
session:session-kN6B9Jl7qyqx-lNHslTsPA


stomp.min.js:8 >>> SUBSCRIBE
id:sub-0
destination:/topic/greetings/1


stomp.min.js:8 <<< ERROR
message:Invalid destination
content-type:text/plain
version:1.0,1.1,1.2
content-length:48

'/greetings/1' is not a valid topic destination

stomp.min.js:8 <<< PONG
stomp.min.js:8 Whoops! Lost connection to http://localhost:8080/gs-guide-websocket

The same code works with Simple broker but does not work with a StompBrokerRelay. Is there some further settings required for this to work with the same code or could this be an issue in BrokerRelay? I came across this post on stackoverflow and it doesn't see to work for me.

I added these dependencies when I turned on Broker relay:

        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-net</artifactId>
        </dependency>
        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.9.Final</version>
        </dependency>

Thanks.

Running Project with Gradle in Intellij

I forked and cloned the repo then opened the project using from Version control option in Intellij.

None of the dependencies are recognised.

I have tried the refresh wheel in the gradle window.

How to change exchange type in this project?

I have tried to substitute every '/topic' to '/direct' or '/fanout', but it always shows Received error like this:

Received ERROR {message=[Unknown destination], content-type=[text/plain], version=[1.0,1.1,1.2], content-length=[145]} session=16d3co4i text/plain payload='/fanout/hello' is not a valid destination.

I think that '/direct', '/fanout', '/topic' all are exchanges created when RabbitMQ server start.So how can't it work ?
I guess maybe the way I subscribe a queue is wrong, still confused.

I have changed two parts in this project as follow:

1.in GreetingController.java

@controller
public class GreetingController {

@MessageMapping("/sock1")
@SendTo("/direct/hello")
public String greeting(String name) throws Exception {

    return name ;
}

}

2.in WebSocketConfig.java

@configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer{

@OverRide
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableStompBrokerRelay("/fanout");
config.setApplicationDestinationPrefixes("/app");
}

@OverRide
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/sock1").withSockJS();
}
}

thanks for your help!

Why HTML5 WebSocket object can not connect to the server directly?

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
    config.enableSimpleBroker("/topic");
    config.setApplicationDestinationPrefixes("/app");
}

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
    registry.addEndpoint("/hello");
}
    // Ingore other empty implements.

}

HTML5 connection method:
var websocket = new WebSocket("ws://localhost:8080/hello")

While WebSocketMessageBrokerConfigurer is version of org.springframework:spring-websocket:4.0.0.RELEASE, the connection method works fine, but if the version turns to 4.0.1.RELEASE or newer, there will be an exception like WebSocket connection to "ws://localhost:8080/hello" failed: Error during WebSocket handshake: Unexpected response code: 403.

Could anyone tell me why that happens? Thanks a lot!

WebSocket connect/disconnect Events

The WebSocket connect/disconnect part doesn't seem to be completed in the back-end Java code. I add the following code to react when the connect button is triggered.

@component
public class WebSocketSessionListener implements ApplicationListener{

@Override
@EventListener
public void onApplicationEvent(SessionConnectEvent event) {
    // handle the connect event
    System.out.println("WebSocket session connected: " + event.getMessage().toString());
}

}

It detects the event, but the events of both connect and disconnect are fired twice for some reason.

Important security issue using the STOMP broker

If I'm not mistaken this app has a very serious problem, that is the fact that any user can send a message to a destination like /topic/greetings and that message would be relayed to every connected user, courtesy of the simple spring broker.

I know this is a sample application but I think this problem is intrinsec in this kind of technology: if you expose the subscribe/publish api to the clients (via the websocket) every user can (ab)use them without any limit, and even without the application knowing nothing about it.

The consequences are as a minimum that:

  • each client subscribed to topics in the /topic namespace can receive forged messages from other users claiming to be the server
  • a single user can spam all the users with no effort, since the relaying of the messages is done by the broker, hence using his bandwidth and computational resources. A single user can broadcast message to (potentially) thousand of users with a single stop frame

Is it possible to solve these problems?
I've not yet figured it how.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.