HSN HSN - 21 days ago 11
Java Question

gradle tomcat plugin not starting websocket

I'm using the bmuschko tomcat plugin with this configuration

apply plugin: 'java' apply plugin: 'war' apply plugin: 'com.bmuschko.tomcat'

configurations {
provided
}

repositories {
mavenCentral() }

tomcat {
httpPort = 8001
contextPath = "/"
}

dependencies {
compile 'junit:junit:4.12'

compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.6'
compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1'
compile group: 'junit', name: 'junit', version: '4.12'
compile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: '5.1.0.Final'

compileOnly group: 'javax.websocket', name: 'javax.websocket-api', version: '1.1'
compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '3.0.1'

def tomcatVersion = '7.0.59'
tomcat "org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"
}

buildscript {
repositories {
jcenter()
}

dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.5'
}
}


But still get this error in Chrome


WebSocket connection to 'ws://localhost:8001/test' failed: Error during WebSocket handshake: Unexpected response code: 404


I assume that the Serverendpoint ist not beeing started. Servlets however start as usual

HSN HSN
Answer

Seems like a problem with the gradle tomcat plugin. I'm using gretty now which works fine.