Since 2.2.0 spring-boot-maven-plugin create 2 java process (may cause CreateProcess error=206). Need workaround to fix it

て烟熏妆下的殇ゞ 提交于 2020-11-29 11:43:32

问题


Since Spring Boot 2.2.0.RELEASE spring-boot-maven-plugin

mvn spring-boot:run -Drun.profiles=prod

create two java process (see https://github.com/spring-projects/spring-boot/issues/17766). In my case:

14811 ?        Sl     1:34 /usr/lib/jvm/java-11-oracle/bin/java -classpath /opt/maven/boot/plexus-classworlds-2.5.2.jar -Dclassworlds.conf=/opt/maven/bin/m2.conf -Dmaven.home=/opt/maven -Dlibrary.jansi.path
=/opt/maven/lib/jansi-native -Dmaven.multiModuleProjectDirectory=/opt/javaops org.codehaus.plexus.classworlds.launcher.Launcher spring-boot:run -Drun.profiles=prod

14841 ?        Sl     8:01 /usr/lib/jvm/java-11-oracle/bin/java -Xverify:none -XX:TieredStopAtLevel=1 -cp /opt/javaops/target/classes:/opt/maven_repo/com/google/http-client/google-http-client/1.34.0/google-
http-client-1.34.0.jar:/opt/maven_repo/javax/xml/bind/jaxb-api/2.4.0-b180830.0359/jaxb-api-2.4.0-b180830.0359.jar:/opt/maven_repo/org/springframework/spring-beans/5.2.3.RELEASE/spring-beans-5.2.3.RELEASE.ja
r:/opt/maven_repo/org/apache/tomcat/embed/tomcat-embed-core/9.0.30/tomcat-embed-core-9.0.30.jar:/opt/maven_repo/com/sun/xml/fastinfoset/FastInfoset/1.2.15/FastInfoset-1.2.15.jar:/opt/maven_repo/com/google/h
ttp-client/google-http-client-jackson2/1.34.1/google-http-client-jackson2-1.34.1.jar:/opt/maven_repo/jakarta/persistence/jakarta.persistence-api/2.2.3/jakarta.persistence-api-2.2.3.jar:/opt/maven_repo/com/g
oogle/oauth-client/google-oauth-client/1.30.5/google-oauth-client-1.30.5.jar:/opt/maven_repo/com/google/apis/google-api-services-admin-directory/directory_v1-rev20191003-1.30.8/google-api-services-admin-dir
ectory-directory_v1-rev20191003-1.30.8.jar:/opt/maven_repo/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar:/opt/maven_repo/org/springframework/spring-expression/5.2.3.RELEASE/spring-expr
ession-5.2.3.RELEASE.jar:/opt/maven_repo/com/sun/activation/jakarta.activation/1.2.1/jakarta.activation-1.2.1.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-security/2.2.3.RELEASE/spring-b
oot-starter-security-2.2.3.RELEASE.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-web/2.2.3.RELEASE/spring-boot-starter-web-2.2.3.RELEASE.jar:/opt/maven_repo/org/hibernate/common/hibernate
-commons-annotations/5.1.0.Final/hibernate-commons-annotations-5.1.0.Final.jar:/opt/maven_repo/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar:/opt/maven_repo/javax/annotation/javax.annotatio
n-api/1.3.2/javax.annotation-api-1.3.2.jar:/opt/maven_repo/org/glassfish/jaxb/jaxb-runtime/2.4.0-b180830.0438/jaxb-runtime-2.4.0-b180830.0438.jar:/opt/maven_repo/org/projectlombok/lombok/1.18.12/lombok-1.18
.12.jar:/opt/maven_repo/org/springframework/boot/spring-boot-autoconfigure/2.2.3.RELEASE/spring-boot-autoconfigure-2.2.3.RELEASE.jar:/opt/maven_repo/org/springframework/spring-aop/5.2.3.RELEASE/spring-aop-5
.2.3.RELEASE.jar:/opt/maven_repo/org/springframework/spring-web/5.2.3.RELEASE/spring-web-5.2.3.RELEASE.jar:/opt/maven_repo/javax/activation/javax.activation-api/1.2.0/javax.activation-api-1.2.0.jar:/opt/mav
en_repo/io/grpc/grpc-context/1.22.1/grpc-context-1.22.1.jar:/opt/maven_repo/org/jvnet/staxex/stax-ex/1.8/stax-ex-1.8.jar:/opt/maven_repo/org/hibernate/hibernate-core/5.4.10.Final/hibernate-core-5.4.10.Final
.jar:/opt/maven_repo/org/jboss/jandex/2.1.1.Final/jandex-2.1.1.Final.jar:/opt/maven_repo/org/apache/httpcomponents/httpcore/4.4.13/httpcore-4.4.13.jar:/opt/maven_repo/org/springframework/boot/spring-boot/2.
2.3.RELEASE/spring-boot-2.2.3.RELEASE.jar:/opt/maven_repo/org/thymeleaf/extras/thymeleaf-extras-java8time/3.0.4.RELEASE/thymeleaf-extras-java8time-3.0.4.RELEASE.jar:/opt/maven_repo/org/slf4j/jul-to-slf4j/1.
7.30/jul-to-slf4j-1.7.30.jar:/opt/maven_repo/com/zaxxer/HikariCP/3.4.2/HikariCP-3.4.2.jar:/opt/maven_repo/com/sun/istack/istack-commons-runtime/3.0.7/istack-commons-runtime-3.0.7.jar:/opt/maven_repo/org/spr
ingframework/spring-orm/5.2.3.RELEASE/spring-orm-5.2.3.RELEASE.jar:/opt/maven_repo/org/apache/logging/log4j/log4j-api/2.12.1/log4j-api-2.12.1.jar:/opt/maven_repo/org/springframework/security/spring-security
-config/5.2.1.RELEASE/spring-security-config-5.2.1.RELEASE.jar:/opt/maven_repo/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-logging/2
.2.3.RELEASE/spring-boot-starter-logging-2.2.3.RELEASE.jar:/opt/maven_repo/javax/activation/activation/1.1.1/activation-1.1.1.jar:/opt/maven_repo/org/springframework/spring-core/5.2.3.RELEASE/spring-core-5.
2.3.RELEASE.jar:/opt/maven_repo/org/apache/tomcat/embed/tomcat-embed-websocket/9.0.30/tomcat-embed-websocket-9.0.30.jar:/opt/maven_repo/com/fasterxml/jackson/core/jackson-annotations/2.10.2/jackson-annotati
ons-2.10.2.jar:/opt/maven_repo/org/springframework/security/spring-security-core/5.2.1.RELEASE/spring-security-core-5.2.1.RELEASE.jar:/opt/maven_repo/com/fasterxml/jackson/core/jackson-databind/2.10.2/jacks
on-databind-2.10.2.jar:/opt/maven_repo/com/h2database/h2/1.3.176/h2-1.3.176.jar:/opt/maven_repo/jakarta/validation/jakarta.validation-api/2.0.2/jakarta.validation-api-2.0.2.jar:/opt/maven_repo/org/springfra
mework/boot/spring-boot-starter-aop/2.2.3.RELEASE/spring-boot-starter-aop-2.2.3.RELEASE.jar:/opt/maven_repo/com/fasterxml/jackson/module/jackson-module-parameter-names/2.10.2/jackson-module-parameter-names-
2.10.2.jar:/opt/maven_repo/com/fasterxml/classmate/1.5.1/classmate-1.5.1.jar:/opt/maven_repo/org/springframework/spring-context/5.2.3.RELEASE/spring-context-5.2.3.RELEASE.jar:/opt/maven_repo/org/springframe
work/spring-aspects/5.2.3.RELEASE/spring-aspects-5.2.3.RELEASE.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-json/2.2.3.RELEASE/spring-boot-starter-json-2.2.3.RELEASE.jar:/opt/maven_repo/
io/opencensus/opencensus-api/0.24.0/opencensus-api-0.24.0.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-validation/2.2.3.RELEASE/spring-boot-starter-validation-2.2.3.RELEASE.jar:/opt/mave
n_repo/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/opt/maven_repo/org/checkerframework/checker-compat-qual/2.5
.5/checker-compat-qual-2.5.5.jar:/opt/maven_repo/com/fasterxml/jackson/datatype/jackson-datatype-jsr310/2.10.2/jackson-datatype-jsr310-2.10.2.jar:/opt/maven_repo/org/springframework/security/spring-security
-web/5.2.1.RELEASE/spring-security-web-5.2.1.RELEASE.jar:/opt/maven_repo/antlr/antlr/2.7.7/antlr-2.7.7.jar:/opt/maven_repo/jakarta/annotation/jakarta.annotation-api/1.3.5/jakarta.annotation-api-1.3.5.jar:/o
pt/maven_repo/com/ibm/icu/icu4j/66.1/icu4j-66.1.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-cache/2.2.3.RELEASE/spring-boot-starter-cache-2.2.3.RELEASE.jar:/opt/maven_repo/org/springfra
mework/boot/spring-boot-starter-thymeleaf/2.2.3.RELEASE/spring-boot-starter-thymeleaf-2.2.3.RELEASE.jar:/opt/maven_repo/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:/opt/maven_repo/org/yaml/
snakeyaml/1.25/snakeyaml-1.25.jar:/opt/maven_repo/net/bytebuddy/byte-buddy/1.10.6/byte-buddy-1.10.6.jar:/opt/maven_repo/jakarta/activation/jakarta.activation-api/1.2.1/jakarta.activation-api-1.2.1.jar:/opt/
maven_repo/org/slf4j/slf4j-api/1.7.30/slf4j-api-1.7.30.jar:/opt/maven_repo/com/fasterxml/jackson/datatype/jackson-datatype-jdk8/2.10.2/jackson-datatype-jdk8-2.10.2.jar:/opt/maven_repo/org/springframework/sp
ring-webmvc/5.2.3.RELEASE/spring-webmvc-5.2.3.RELEASE.jar:/opt/maven_repo/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/opt/maven_repo/org/springframework/spring-context-support/5.2.3.RELEASE/spri
ng-context-support-5.2.3.RELEASE.jar:/opt/maven_repo/androidx/annotation/annotation/1.1.0/annotation-1.1.0.jar:/opt/maven_repo/jakarta/transaction/jakarta.transaction-api/1.3.3/jakarta.transaction-api-1.3.3
.jar:/opt/maven_repo/org/springframework/data/spring-data-jpa/2.2.4.RELEASE/spring-data-jpa-2.2.4.RELEASE.jar:/opt/maven_repo/org/apache/commons/commons-lang3/3.9/commons-lang3-3.9.jar:/opt/maven_repo/org/s
pringframework/boot/spring-boot-starter-data-jpa/2.2.3.RELEASE/spring-boot-starter-data-jpa-2.2.3.RELEASE.jar:/opt/maven_repo/org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.jar:/opt/m
aven_repo/org/springframework/boot/spring-boot-configuration-processor/2.2.3.RELEASE/spring-boot-configuration-processor-2.2.3.RELEASE.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-tomcat
/2.2.3.RELEASE/spring-boot-starter-tomcat-2.2.3.RELEASE.jar:/opt/maven_repo/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar:/opt/maven_repo/org/springframework/spring-t
x/5.2.3.RELEASE/spring-tx-5.2.3.RELEASE.jar:/opt/maven_repo/org/attoparser/attoparser/2.0.5.RELEASE/attoparser-2.0.5.RELEASE.jar:/opt/maven_repo/com/google/api-client/google-api-client/1.30.8/google-api-cli
ent-1.30.8.jar:/opt/maven_repo/org/thymeleaf/thymeleaf-spring5/3.0.11.RELEASE/thymeleaf-spring5-3.0.11.RELEASE.jar:/opt/maven_repo/com/fasterxml/jackson/core/jackson-core/2.10.2/jackson-core-2.10.2.jar:/opt
/maven_repo/org/hibernate/validator/hibernate-validator/6.0.18.Final/hibernate-validator-6.0.18.Final.jar:/opt/maven_repo/org/apache/httpcomponents/httpclient/4.5.10/httpclient-4.5.10.jar:/opt/maven_repo/co
m/google/guava/guava/28.2-android/guava-28.2-android.jar:/opt/maven_repo/org/springframework/data/spring-data-commons/2.2.4.RELEASE/spring-data-commons-2.2.4.RELEASE.jar:/opt/maven_repo/org/unbescape/unbesc
ape/1.1.6.RELEASE/unbescape-1.1.6.RELEASE.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-mail/2.2.3.RELEASE/spring-boot-starter-mail-2.2.3.RELEASE.jar:/opt/maven_repo/org/jsoup/jsoup/1.13.
1/jsoup-1.13.1.jar:/opt/maven_repo/org/aspectj/aspectjweaver/1.9.5/aspectjweaver-1.9.5.jar:/opt/maven_repo/org/springframework/spring-jcl/5.2.3.RELEASE/spring-jcl-5.2.3.RELEASE.jar:/opt/maven_repo/org/glass
fish/jaxb/txw2/2.3.2/txw2-2.3.2.jar:/opt/maven_repo/commons-codec/commons-codec/1.13/commons-codec-1.13.jar:/opt/maven_repo/com/sun/mail/jakarta.mail/1.6.4/jakarta.mail-1.6.4.jar:/opt/maven_repo/org/apache/
logging/log4j/log4j-to-slf4j/2.12.1/log4j-to-slf4j-2.12.1.jar:/opt/maven_repo/org/springframework/boot/spring-boot-starter-jdbc/2.2.3.RELEASE/spring-boot-starter-jdbc-2.2.3.RELEASE.jar:/opt/maven_repo/org/t
hymeleaf/thymeleaf/3.0.11.RELEASE/thymeleaf-3.0.11.RELEASE.jar:/opt/maven_repo/org/apache/tomcat/embed/tomcat-embed-el/9.0.30/tomcat-embed-el-9.0.30.jar:/opt/maven_repo/org/springframework/boot/spring-boot-
starter/2.2.3.RELEASE/spring-boot-starter-2.2.3.RELEASE.jar:/opt/maven_repo/org/javassist/javassist/3.24.0-GA/javassist-3.24.0-GA.jar:/opt/maven_repo/io/opencensus/opencensus-contrib-http-util/0.24.0/opence
nsus-contrib-http-util-0.24.0.jar:/opt/maven_repo/org/springframework/spring-jdbc/5.2.3.RELEASE/spring-jdbc-5.2.3.RELEASE.jar:/opt/maven_repo/org/dom4j/dom4j/2.1.1/dom4j-2.1.1.jar ru.javaops.JavaOPsApplicat
ion

It is too verbose and for Windows could cause of "error CreateProcess error=206, The filename or extension is too long" (see Jhipster 5.7 microservice failed to start on windows with error CreateProcess error=206, The filename or extension is too long).

What is the best way to fix it (exclude return to previous version:)?


回答1:


Apparently, forking is enabled by default since Spring Boot 2.2.

Disable it again might help.

Add -Dspring-boot.run.fork=false to your maven command or configure it in your pom.xml:

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <fork>false</fork>
    </configuration>
</plugin>


来源:https://stackoverflow.com/questions/61125404/since-2-2-0-spring-boot-maven-plugin-create-2-java-process-may-cause-createproc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!