sevdokimov / log-viewer

Web UI for viewing logs
Apache License 2.0
481 stars 105 forks source link

IllegalStateException: Cannot load configuration class: com.logviewer.LvStandaloneConfig when launching the viewer #61

Open tomasrollo opened 3 years ago

tomasrollo commented 3 years ago

Hi, I'm getting the following exception when trying to run the log-viewer from inside an openjdk:latest container:

Exception in thread "main" java.lang.IllegalStateException: Cannot load configuration class: com.logviewer.LvStandaloneConfig
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:414)
        at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:254)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:282)
        at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126)
        at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:706)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533)
        at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:88)
        at com.logviewer.LogViewerMain.startup(LogViewerMain.java:70)
        at com.logviewer.LogViewerMain.main(LogViewerMain.java:234)
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:403)
        ... 8 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 @20f5239f
        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)
        ... 11 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 @20f5239f
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
        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:554)
        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)
        ... 23 more

Steps to reproduce:

  1. Create a new container from openjdk:latest
  2. Login into the container command line
  3. unzip the log-viewer-0.1.6.zip there
  4. try to start the log-viewer
tomasrollo commented 3 years ago

Update: seems to have something to do with which version of Java is used (see https://stackoverflow.com/a/41265267)

I tried to use https://hub.docker.com/r/adoptopenjdk/openjdk8 as image for the container instead and logviewer starts there.