运行 app as jar 给出 fileNotFoundException

running app as jar gives fileNotFoundException

我正在尝试 运行 我的 spring 应用程序作为一个 jar,但我收到以下错误

java.io.FileNotFoundException: class path resource [org/springframework/web/socket/config/annotation/AbstractWebSocketMessageBrokerConfigurer.class] cannot be opened because it does not exist

它 运行 来自 intelij 很好(因为在我的主要 class 中可以 运行 使用播放按钮)。我在项目结构 --> 库和外部库下找到文件(尽管已损坏) 我试图研究它,但到处(下面的示例列表)似乎都在谈论 xml 文件而不是 class

Class path resource cannot be opened because it does not exist

How to avoid "class path resource [...] cannot be opened because it does not exist" in a spring boot application?

我的 gradle 文件:

plugins {
    id 'org.springframework.boot' version '2.2.4.RELEASE'
    id 'io.spring.dependency-management' version '1.0.9.RELEASE'
    id 'war'
    id 'groovy'
//    id 'java'
}
war {
    enabled = true
}
jar {
    manifest {
        attributes 'Main-Class': 'co.za.ebucks.HandlingRewardsFormSubmission'
    }
}

group = 'co.za.ebucks'
version = '1.0.0'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}
ext {
    seleniumVersion = '3.141.59'
}
configurations {
    developmentOnly
    runtimeClasspath {
        extendsFrom developmentOnly
    }
}
test {
    useTestNG()
}

dependencies {

    implementation 'org.springframework.boot:spring-boot-starter-tomcat'
    implementation 'org.springframework.boot:spring-boot-starter-actuator'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.boot:spring-boot-starter-webflux'
//    implementation 'org.springframework.session:spring-session-core'
    implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
    implementation 'org.springframework.boot:spring-boot-starter-integration'
    implementation 'org.springframework.boot:spring-boot-starter-websocket'
    implementation 'org.springframework:spring-messaging'
    implementation 'org.springframework.integration:spring-integration-file'

    implementation group: 'org.webjars.bower', name: 'angular-ui-router', version: '0.2.8'
    implementation group: 'org.webjars', name:'angularjs', version: '1.3.0-beta.11'
    implementation group: 'org.webjars', name: 'bootstrap', version: '3.1.1-1'

//    implementation 'org.webjars.bower:angular-ui-router'//, version: '1.0.20'

    implementation 'commons-io:commons-io'//, version: '2.4'
    implementation 'org.apache.commons:commons-dbcp2'//, version: '2.7.0'
    implementation 'org.hibernate.validator:hibernate-validator'//, version: '6.1.2.Final'
//    implementation 'nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect'//, version: '2.4.1'
    implementation 'javax.servlet:javax.servlet-api'//, version: '4.0.1'
//    compile group: 'org.apache.tomcat', name: 'tomcat-jni', version: '9.0.33'

    implementation group: 'de.codecentric', name: 'spring-boot-admin-starter-client', version: '2.2.2'
    implementation group: 'de.codecentric', name: 'spring-boot-admin-server', version: '2.2.2'
    implementation group: 'org.testng', name: 'testng', version: '7.1.0'
    implementation group: 'org.codehaus.groovy', name: 'groovy-all', version: '3.0.0'
    implementation group: 'com.google.inject', name: 'guice', version: '4.2.2'
    implementation group: 'com.google.guava', name: 'guava', version: '28.1-jre'
    implementation group: 'cglib', name: 'cglib', version: '3.3.0'
    implementation group: 'org.postgresql', name: 'postgresql', version: '42.2.10'

    testImplementation('org.springframework.boot:spring-boot-starter-test') {
        exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
    }
    testImplementation 'io.projectreactor:reactor-test'
    implementation "org.seleniumhq.selenium:selenium-support:${seleniumVersion}"
    implementation group: 'io.appium', name: 'java-client', version: '7.3.0'
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-java', version: "${seleniumVersion}"
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-server', version: "${seleniumVersion}"
    implementation group: 'org.seleniumhq.selenium', name: 'selenium-chrome-driver', version: "${seleniumVersion}"

    testImplementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.0'
    testImplementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.13.0'
    testImplementation group: 'org.testng', name: 'testng', version: '7.1.0'

    developmentOnly 'org.springframework.boot:spring-boot-devtools'
}

我确定有问题的 class:

import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.AbstractWebSocketMessageBrokerConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry
import org.springframework.web.socket.server.support.DefaultHandshakeHandler;

@Configuration
@EnableWebSocketMessageBroker
class WebSocketDefaultConfig extends AbstractWebSocketMessageBrokerConfigurer {

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

    @Override
    void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/tailfilesep")
//                .setAllowedOrigins("*")
//                .setHandshakeHandler(new DefaultHandshakeHandler())
                .withSockJS()
    }
}

请帮帮我,这已经过去了。为什么 class 不在罐子里?

唯一有用的是创建一个新项目 - 复制并粘贴所有代码,构建所有文件...哈哈,很好。

沿线某处的 Intelij 损坏