我正在使用具有此配置的bmuschko tomcat插件

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'
    }
}

但仍然在Chrome中出现此错误



我认为Serverendpoint不会启动。 Servlet照常启动

最佳答案

gradle tomcat插件似乎有问题。我现在使用的是gretty,效果很好。

关于java - gradle tomcat插件未启动websocket,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40516642/

10-10 19:54