인프런 커뮤니티 질문&답변

김동운님의 프로필 이미지
김동운

작성한 질문수

스프링 부트 개념과 활용

스프링 부트 시작하기

mvn package 관련..

해결된 질문

작성

·

850

0

패키징하고 java -jar 를하게되면 아래와 같이 실패하게 되는데 혹시 원인을 알 수 있을까요? 검색해보고 시도(cglib추가, 메이븐 다시 다운받아서 환경등록후 실행)를 해봤는데 안되네요...

start.spring.io 에서 생성해주면 되는데..인텔리j maven으로 아무리 강의를 다시보고 똑같이 해도 ㅠㅠ안되네요.. 

 

java.lang.IllegalStateException: Cannot load configuration class: me.dongwoon.Application

        at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:414) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:254) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:128) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]

        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]

        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395) ~[spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]

        at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) ~[spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]

        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) ~[spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]

        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) ~[spring-boot-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]

        at me.dongwoon.Application.main(Application.java:9) ~[classes!/:1.0-SNAPSHOT]

        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]

        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]

        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]

        at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]

        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) ~[spring-boot-getting-started-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]

        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) ~[spring-boot-getting-started-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]

        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) ~[spring-boot-getting-started-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]

        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) ~[spring-boot-getting-started-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]

Caused by: java.lang.ExceptionInInitializerError: null

        at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:122) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:110) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403) ~[spring-context-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        ... 20 common frames omitted

Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @6c629d6e

        at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]

        at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:174) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:153) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        ... 23 common frames omitted

Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @6c629d6e

        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[na:na]

        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[na:na]

        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199) ~[na:na]

        at java.base/java.lang.reflect.Method.setAccessible(Method.java:193) ~[na:na]

        at org.springframework.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at java.base/java.security.AccessController.doPrivileged(AccessController.java:569) ~[na:na]

        at org.springframework.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:52) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329) ~[spring-core-5.0.7.RELEASE.jar!/:5.0.7.RELEASE]

        ... 35 common frames omitted

 

 

답변 1

2

김동운님의 프로필 이미지
김동운
질문자

ㅎㅎ부끄럽지만 메이븐을 설치를 안했었네요..! 그래도 기선님따라 공식문서를 열심히 보려고 노력했고 공식문서에서 답을 찾았습니다!

On many operating systems, Maven can be installed with a package manager. If you use OSX Homebrew, try brew install maven. Ubuntu users can run sudo apt-get install maven. Windows users with Chocolatey can run choco install maven from an elevated (administrator) prompt.

 

질문 자체가 부끄럽게 느껴지지만 저와 같은 누군가한테는 도움이 될거라 여기며 냅두겠습니다!

정말 수없이 프로젝트를 지웠다 만들었다 하면서 찾았네요. 그러다 공식문서를 다시 봐야겠다는 생각이 문득들어 차근차근 읽어보면서 답을 얻었습니다. 뿌듯 😂

 

공식문서링크

 

백기선님의 프로필 이미지
백기선
지식공유자

잘하셨어요!

김동운님의 프로필 이미지
김동운

작성한 질문수

질문하기