0

Trying this guide. Could run it as in example, but can not convert it to war file using web.xml and spring xml config files.
Here is what I did, but it is not working.
When I press "connect" I got

GET _http://localhost:8080/hello/info 404 (Not Found)

in browser console and

WARNING: No mapping found for HTTP request with URI [/hello/info] in DispatcherServlet with name 'mvc-dispatcher'

in tomcat log

UPDATE:
Page _http://localhost:8080/hello says "Welcome to SockJS!"

UPDATE 2

Ok, I found this question:
Spring Websocket and 404 status on connection
It says that servlet-mapping should be "/". And tells how to get acces to index.html (in comment). I tried and it works... Now I have this browser console output:

Opening Web Socket...
stomp.js:130 Web Socket Opened...
stomp.js:130 >>> CONNECT
accept-version:1.1,1.0
heart-beat:10000,10000
Whoops! Lost connection to undefined

And tomcat log:

SEVERE: Broken data received. Terminating WebSocket connection abruptly java.lang.IllegalStateException: A SockJsMessageCodec is required but not available: Add Jackson 2 to the classpath, or configure a custom SockJsMessageCodec.

UPDATE 3

adding Jaskson 2 dependensy to pom.xml (important version 2.1.0 or above) solved problem:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.1.0</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.1.0</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-annotations</artifactId>
    <version>2.1.0</version>
</dependency>

It works, but returns 7 answers to one request...

FINAIL UPDATE

I had two configurations: in mvc-dispatcher-servlet.xml and in java code. Both of them worked, so requests and answers intersects and multiplies. Final version can be found in github, commit 2b2e605b39d8acfc8913b836dadb1ab2c19b4795

Community
  • 1
  • 1
sinedsem
  • 5,413
  • 7
  • 29
  • 46

0 Answers0