intelliJ를 사용해서 프로젝트 시작 중 아래와 같은 에러가 발생했을때

CreateProcess error=206, 파일 이름이나 확장명이 너무 깁니다

아래와 같은 플러그 인으로 해결

요약

문제 원인 :

gradle 에서 java를 실행할때, commandline으로 실행을 하는데, classpath의 길이가 너무 길어서 발생

이것을 manifest jar로 만들어서 실행해줌


gradle-util-plugins

When classpath for a Gradle JavaExec task is long, Windows command executions give error because of limitation to command line length greater than 32K.

With a number of classpath dependencies in a large project, typically JavaExec Gradle task fails with error "The filename or extension is too long" and this would be a stopping error. To solve this issue, use ManifestClasspath plugin.

ManifestClasspath plugin creates a manifest jar for jar files in the classpath of JavaExec task and sets the classpath with manifest jar.

Usage

To use the plugin, define a dependency in build script and have plugin entry in Gradle project.

build.gradle snippet to use ManifestClasspath plugin

Build script snippet for plugins DSL for Gradle 2.1 and later

plugins {
  id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
}

Build script snippet for use in older Gradle versions or where dynamic configuration is required

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "gradle.plugin.com.github.viswaramamoorthy:gradle-util-plugins:0.1.0-RELEASE"
  }
}

apply plugin: "com.github.ManifestClasspath"

https://github.com/viswaramamoorthy/gradle-util-plugins

'BackEnd > ETC' 카테고리의 다른 글

Git remote: Permission to  (0) 2020.03.08
http 상태 코드  (0) 2020.01.19
CQRS란 ?  (1) 2020.01.19
STORM 정리  (0) 2017.12.18

Elasticsearch를 설치하고 실행할 때, 아래와 같은 오류가 나서 실행이 되지 않는다.

[WARN ][o.e.b.Natives            ] unable to loa
d JNA native support library, native methods will be disabled.
java.lang.UnsatisfiedLinkError: /tmp/elasticsearch.PRdXLpjT/jna--19853545
63/jna2901201660730912229.tmp: /tmp/elasticsearch.PRdXLpjT/jna--198535456
3/jna2901201660730912229.tmp: failed to map segment from shared object: O
peration not permitted
        at java.lang.ClassLoader

Operation not permitted
tmp/elasticsearch 를 허가하지않는것(tmp디렉토리 접근 관련 권한 문제)

해결 방법
jvm.options 파일의 -Djava.io.tmpdir 의 경로를 루트의 tmp가 아닌 elasticsearch를 사용하는 유저의 디렉토리로 설정 해서 해결
 68 # log4j 2
 69 -Dlog4j.shutdownHookEnabled=false
 70 -Dlog4j2.disable.jmx=true
 71
 72 #-Djava.io.tmpdir=${ES_TMPDIR} ##원본
 73 -Djava.io.tmpdir=/home/userid/es_temp ##수정 한부분

SLF4J: Detected both log4j-over-slf4j.jar AND bound slf4j-log4j12.jar on the class path, preempting StackOverflowError

위와 같은 이슈가 발생했다.

다른 프로젝트를 gradle compile 로 가지고 오는데 다른프로젝트의 내부에서 slf4j-log4j12 라이르러리를 가지고 있어서 , springboot에서 빌드 할때 bridge가 log4j12-over-slf4j 로 되어있고, binding이 slf4j-log4j12 로 가지게 되면 계속 무한 반복이 일어나기 때문에 아래와 같은 에러를 발생시키는것이다.

아래 세부 로그를 보면 binding 할때 두개의 라이브러리를 찾았다. logback 과 slf4j-log4j12 이다 .

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/KDY/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.2.3/7c4f3c474fb2c041d8028740440937705ebb473a/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/KDY/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-log4j12/1.7.16/54c6dd23a7c420e40b8848e962d5f2a3534260af/slf4j-log4j12-1.7.16.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

import 하는 프로젝트의 gradle 설정에서 아래와 같이 slf4j-log4j12 바인딩의 라이브러리를 제외 시켜 줌 으로써 해결

configurations.all{
    exclude group: 'org.slf4j', module: 'slf4j-log4j12'
}

스프링 부트 관련 Bridge, Binding 에 대한 설명은 아래의 포스트에 설명이 되어있다.
https://deviscreen.tistory.com/118

'BackEnd > SpringBoot' 카테고리의 다른 글

[SpringBoot]Validation 에러 처리하기  (0) 2021.08.22
Spring Boot Logging (1)  (0) 2020.04.16
Request Body 의 값 BadRequest 로 보내기  (0) 2020.04.11
SpringBoot(4) -T-Academy  (0) 2019.05.24
SpringBoot(3)-T-Academy  (0) 2019.05.22

+ Recent posts