하아안우
115
2021-12-21 22:38:44
1
289

저.. 스프링 질문 하나만 하겠습니다..


제가 1시간 째 붙잡다가 도저히 구글링해도 모르겠고 해서 여기에 올립니다.

초보웹개발자를위한스프링입문5라는 책을 읽으면서 공부중인데 처음 Maven설정하고 간단한 Hello프로그램 하나 만드는겁니다.

인텔리제이로 프로그램을 작성하는 중, Appcontext에 Configuration 어노테이션을 달면 

Exception in thread "main" java.lang.IllegalStateException: Cannot load configuration class: ch02.AppContext

at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:416)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:254)

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284)

at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:128)

at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:693)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:531)

at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:88)

at ch02.Main.main(Main.java:7)

Caused by: java.lang.ExceptionInInitializerError

at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:122)

at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:110)

at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:405)

... 7 more

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 @3e6fa38a

at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464)

at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336)

at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93)

at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91)

at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)

at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)

at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34)

at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116)

at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291)

at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221)

at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:174)

at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:153)

at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73)

... 10 more

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 @3e6fa38a

at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)

at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)

at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)

at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)

at org.springframework.cglib.core.ReflectUtils$1.run(ReflectUtils.java:61)

at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)

at org.springframework.cglib.core.ReflectUtils.<clinit>(ReflectUtils.java:52)

at org.springframework.cglib.core.KeyFactory$Generator.generateClass(KeyFactory.java:243)

at org.springframework.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)

at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:329)

... 22 more

이렇게 나오면서 실행이 안되네요. 근데 또 Configuration 어노테이션 떼면 실행 잘 되고ㅠㅠ

혹시 뭐가 문제인지 알려주실 수 있을까요..

0
  • 답변 1

  • kenu
    62k
    2021-12-21 22:45:55
    해당 게시물은 관리자에 의해 사는얘기에서 Tech Q&A로 이동 되었습니다.
  • 로그인을 하시면 답변을 등록할 수 있습니다.