着色jar ClassNotFoundException:org.springframework.boot.logging.java.JavaLoggingSystem

着色jar ClassNotFoundException:org.springframework.boot.logging.java.JavaLoggingSystem,java,maven,spring-boot,exception,integration-testing,Java,Maven,Spring Boot,Exception,Integration Testing,我正在使用Maven创建一个可引导的着色的jar。i、 e.它包含所有必需的依赖项,并且应该使用 java-jar integration-tests.jar 但是当我执行这段代码时,它会产生以下异常 Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.

我正在使用Maven创建一个可引导的着色的jar。i、 e.它包含所有必需的依赖项,并且应该使用

java-jar integration-tests.jar

但是当我执行这段代码时,它会产生以下异常

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.IllegalStateException: java.lang.ClassNotFoundException: org.springframework.boot.logging.java.JavaLoggingSystem
    at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:130)
    at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:117)
    at com.ciscospark.integration.JUnitTestRunner.main(JUnitTestRunner.java:41)
    ... 8 more
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.logging.java.JavaLoggingSystem
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:250)
    at org.springframework.boot.logging.LoggingSystem.get(LoggingSystem.java:125)
    ... 10 more
但奇怪的是,如果我解压缩integration-tests.jar,我会发现

已提取/BOOT-INF/libspring-BOOT-1.4.7.RELEASE.jar

我将在其中找到

./org/springframework/boot/logging/java/JavaLoggingSystem.class

我做错了什么

我的Maven配置

<build>
    <finalName>integration-tests</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <mainClass>com.integration.JUnitTestRunner</mainClass>
                <finalName>integration-tests</finalName>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>repackage</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>2.20.1</version>
            <configuration>
                <testClassesDirectory>${project.build.outputDirectory}</testClassesDirectory>
                <testSourceDirectory>${project.build.sourceDirectory}</testSourceDirectory>
            </configuration>
            <executions>
                <execution>
                    <id>integration-tests</id>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.codehaus.cargo</groupId>
            <artifactId>cargo-maven2-plugin</artifactId>
            <version>1.6.2</version>
            <configuration>
                <container>
                    <containerId>tomcat7x</containerId>
                </container>
                <configuration>
                    <type>standalone</type>
                    <properties>
                        <cargo.servlet.port>${tomcat.server.port}</cargo.servlet.port>
                        <cargo.rmi.port>${tomcat.rmi.port}</cargo.rmi.port>
                        <cargo.tomcat.ajp.port>${tomcat.ajp.port}</cargo.tomcat.ajp.port>
                    </properties>
                </configuration>
                <deployables>
                    <deployable>
                        <groupId>com.me</groupId>
                        <artifactId>my-server</artifactId>
                        <type>war</type>
                        <properties>
                            <context>/</context>
                        </properties>
                        <pingUrlPath>/ping</pingUrlPath>
                    </deployable>
                </deployables>
            </configuration>
            <executions>
                <execution>
                    <id>start-server</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>start</goal>
                    </goals>
                </execution>
                <execution>
                    <id>stop-server</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

集成测试
org.springframework.boot
springbootmaven插件
com.integration.junitestrunner
集成测试
重新包装
maven故障保护插件
2.20.1
${project.build.outputDirectory}
${project.build.sourceDirectory}
集成测试
集成测试
验证
org.codehaus.cargo
cargo-maven2-plugin
1.6.2
tomcat7x
独立的
${tomcat.server.port}
${tomcat.rmi.port}
${tomcat.ajp.port}
com.me
我的服务器
战争
/
/平
启动服务器
预集成测试
开始
停止服务器
整合后测试
停止

我只在打包具有所有依赖项的应用程序时,设法让spring boot maven插件特别工作。除此之外,它似乎不起作用

我的理论是,当你启动一个SpringBoot应用程序时,它做的第一件事就是提取你需要的所有罐子,但我从来没有费心进一步研究它


为了解决您的问题,我建议您使用maven assembly插件来执行fatjar包。

See?我没有。很好的提示。欢迎…,但是看起来spring boot maven插件确实被你的(非常特殊的)需要所过度训练了-如果你很灵活,那么更多地以“文档化的方式”使用该插件,如果不是-多少同意@Hitobat和
com.integration。JunitestRunner
是可疑的!我将研究maven汇编插件