要发布MultipartFile数据,Spring控制器会发生httpServletMapping()错误

下面的方法用于发布MultipartFile数据,并且执行得很好。我能够调试,并且还可以返回return语句,该响应可在邮递员处获得。问题是,当控制进入以下方法时,会发生上述错误。 是弹簧控制器的方法。

@RequestMapping(value =VideoSvcApi.VIDEO_DATA_PATH , method = RequestMethod.POST,consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
    public @ResponseBody VideoStatus addVideoBinaryData(@PathVariable Long id,
                                                        @RequestParam("data") MultipartFile videoData,
                                                        HttpServletResponse response,HttpServletRequest request) throws IOException{
        VideoFileManager fileManager=VideoFileManager.get();
        Video video = videos.get(id);
        response.setHeader("Content-Type", "application/json");
        if (video == null) {
            try {
                response.sendError(HttpServletResponse.SC_NOT_FOUND,"Video not found.");
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else {
            fileManager.saveVideoData(video, videoData.getInputStream());
            response.setStatus(SC_OK);
            return new VideoStatus(VideoStatus.VideoState.READY);
        }
        return null;
    }

下面的文件是My build.gradle文件。

plugins {
    id 'org.springframework.boot' version '2.2.7.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'java'
}

group = 'org.magnum.dataup'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()

    flatDir {
        dirs 'lib'
    }
}

dependencies {
    implementation("org.springframework.boot:spring-boot-starter-data-jpa")
    implementation("org.springframework.boot:spring-boot-starter-web")

    implementation("org.apache.httpcomponents:httpclient:4.5.6")


    implementation("org.hsqldb:hsqldb")

    implementation("com.google.guava:guava:17.0")
    implementation("org.apache.commons:commons-lang3:3.3.2")
    implementation("com.squareup.retrofit:retrofit:1.6.0")
    implementation("commons-io:commons-io:2.4")

    implementation("com.github.davidmarquis:fluent-interface-proxy:1.3.0")
    implementation(":mobilecloud.handin:1.0.0")
    implementation(":video.up.test:1.0.0")
    implementation(":autograder.handin:1.0.0")
    implementation(":autograder.spec:1.0.0")

    implementation("junit:junit")


    testImplementation("org.springframework.boot:spring-boot-starter-test")
}

test {
    useJUnitPlatform()
}

这是错误。我是Gradle的新手,我尝试了各种在Internet上找到的方法。

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;
    at org.apache.catalina.core.ApplicationHttpRequest.setRequest(ApplicationHttpRequest.java:708) ~[tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.core.ApplicationHttpRequest.<init>(ApplicationHttpRequest.java:114) ~[tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.core.ApplicationDispatcher.wrapRequest(ApplicationDispatcher.java:917) ~[tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:358) ~[tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312) ~[tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:394) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:253) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:175) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.34.jar:9.0.34]
    at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
评论