Skip to content

java.lang.NoSuchFieldError: MESSAGE_COLLECTOR_KEY when running on Docker #793

@jpswing

Description

@jpswing

On latest master branch 27cf911006c5e987eec024660ed4e0807529697e

Build the image using

$ ./docker-image-build.sh

Build output:

Kotlin Version for the docker: 2.1.10
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s

#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 2.28kB done
#2 DONE 0.0s

#3 [internal] load metadata for docker.io/library/amazoncorretto:17
#3 DONE 1.2s

#4 [stage-1  1/16] FROM docker.io/library/amazoncorretto:17@sha256:f4d68717f83ddc0b4bb2348c80e1b5730be891a651a2ecdafebae66dca1e9cec
#4 resolve docker.io/library/amazoncorretto:17@sha256:f4d68717f83ddc0b4bb2348c80e1b5730be891a651a2ecdafebae66dca1e9cec 0.0s done
#4 ...

#5 [internal] load build context
#5 transferring context: 4.36MB 0.2s done
#5 DONE 0.2s

#4 [stage-1  1/16] FROM docker.io/library/amazoncorretto:17@sha256:f4d68717f83ddc0b4bb2348c80e1b5730be891a651a2ecdafebae66dca1e9cec
...

#6 [build 2/7] RUN if [ -z "2.1.10" ]; then         echo "Error: KOTLIN_VERSION argument is not set. Use docker-image-build.sh to build the image." >&2;         exit 1;     fi
#6 DONE 1.4s

#7 [stage-1  2/16] RUN mkdir /kotlin-compiler-server
#7 DONE 1.4s

#8 [stage-1  3/16] WORKDIR /kotlin-compiler-server
#8 DONE 0.1s

#9 [build 3/7] RUN mkdir -p /kotlin-compiler-server
#9 DONE 0.6s

#10 [build 4/7] WORKDIR /kotlin-compiler-server
#10 DONE 0.1s

#11 [build 5/7] ADD . /kotlin-compiler-server
#11 DONE 0.2s

#12 [build 6/7] RUN ./gradlew build -x test
#12 0.445 Downloading https://services.gradle.org/distributions/gradle-8.9-bin.zip
#12 1.409 ............10%.............20%.............30%.............40%.............50%.............60%.............70%.............80%.............90%.............100%
#12 4.299
#12 4.299 Welcome to Gradle 8.9!
#12 4.299
#12 4.300 Here are the highlights of this release:
#12 4.301  - Enhanced Error and Warning Messages
#12 4.301  - IDE Integration Improvements
#12 4.301  - Daemon JVM Information
#12 4.301
#12 4.302 For more details see https://docs.gradle.org/8.9/release-notes.html
#12 4.302
#12 4.498 Starting a Gradle Daemon (subsequent builds will be faster)
#12 4.498 Daemon JVM discovery is an incubating feature.
#12 7.798 Calculating task graph as no cached configuration is available for tasks: build
#12 113.2 > Configure project :
#12 113.2 w: file:///kotlin-compiler-server/build.gradle.kts:170:54: 'nodeJsSetupTaskProvider: TaskProvider<out NodeJsSetupTask>' is deprecated. Use nodeJsSetupTaskProvider from NodeJsExtension (not NodeJsRootExtension) insteadYou can find this extension after applying NodeJsPlugin
#12 113.2 w: file:///kotlin-compiler-server/build.gradle.kts:176:65: 'requireConfigured(): NodeJsEnv' is deprecated. Use NodeJsExtension instead. This will be removed in 2.2
#12 114.5 Generate properties into /kotlin-compiler-server/src/main/resources/application.properties
#12 114.5 Generate properties into /kotlin-compiler-server/src/main/resources/application.properties
#12 114.5 Using Kotlin compiler 2.1.10
#12 158.5
#12 158.5 > Task :executors:checkKotlinGradlePluginConfigurationErrors SKIPPED
#12 158.5 > Task :common:checkKotlinGradlePluginConfigurationErrors SKIPPED
#12 158.5 > Task :executors:processResources NO-SOURCE
#12 158.5 > Task :common:processResources NO-SOURCE
#12 158.5 > Task :checkKotlinGradlePluginConfigurationErrors SKIPPED
#12 158.5 > Task :dependencies:copyComposeWasmCompilerPlugins
#12 158.5 > Task :indexation:checkKotlinGradlePluginConfigurationErrors SKIPPED
#12 158.5 > Task :dependencies:copyCompilerPluginDependencies
#12 158.5 > Task :indexation:processResources NO-SOURCE
#12 158.5 > Task :check UP-TO-DATE
#12 158.5 > Task :common:check UP-TO-DATE
#12 158.5 > Task :dependencies:checkKotlinGradlePluginConfigurationErrors SKIPPED
#12 158.5 > Task :dependencies:copyWasmDependencies
#12 158.5 > Task :dependencies:processResources NO-SOURCE
#12 158.5 > Task :dependencies:compileKotlin NO-SOURCE
#12 158.5 > Task :dependencies:check UP-TO-DATE
#12 158.5 > Task :executors:check UP-TO-DATE
#12 158.5 > Task :indexation:check UP-TO-DATE
#12 158.5 > Task :dependencies:compileJava NO-SOURCE
#12 158.5 > Task :dependencies:classes UP-TO-DATE
#12 158.5 > Task :dependencies:copyJSDependencies
#12 158.5 > Task :dependencies:jar
#12 158.5 > Task :dependencies:assemble
#12 158.5 > Task :dependencies:build
#12 158.6 > Task :dependencies:copyDependencies
#12 158.6 > Task :dependencies:copyComposeWasmDependencies
#12 158.7 > Task :processResources
#12 171.9 > Task :common:compileKotlin
#12 171.9 > Task :common:compileJava NO-SOURCE
#12 171.9 > Task :common:classes UP-TO-DATE
#12 171.9 > Task :executors:compileKotlin
#12 171.9 > Task :common:jar
#12 171.9 > Task :common:assemble
#12 171.9 > Task :common:build
#12 171.9 > Task :executors:compileJava NO-SOURCE
#12 171.9 > Task :executors:classes UP-TO-DATE
#12 172.0 > Task :executors:jar
#12 172.0 > Task :executors:assemble
#12 172.0 > Task :executors:build
#12 177.6 > Task :indexation:compileKotlin
#12 177.6 > Task :indexation:compileJava NO-SOURCE
#12 177.6 > Task :indexation:classes UP-TO-DATE
#12 177.6 > Task :indexation:jar
#12 183.0 > Task :indexation:startScripts
#12 184.8 > Task :indexation:distTar
#12 192.1 > Task :indexation:distZip
#12 192.1 > Task :indexation:assemble
#12 192.1 > Task :indexation:build
#12 207.6 > Task :indexation:run
Connection to 165.22.144.4 closed by remote host.
#17 [stage-1  7/16] COPY --from=build /kotlin-compiler-server/ /kotlin-compiler-server/
#17 DONE 1.9s

#18 [stage-1  8/16] COPY --from=build /kotlin-compiler-server/ /kotlin-compiler-server/
#18 DONE 2.0s

#19 [stage-1  9/16] COPY --from=build /kotlin-compiler-server/ /kotlin-compiler-server/
#19 DONE 2.1s

#20 [stage-1 10/16] COPY --from=build /kotlin-compiler-server/ /kotlin-compiler-server/
#20 DONE 2.0s

#21 [stage-1 11/16] COPY --from=build /kotlin-compiler-server/ /kotlin-compiler-server/
#21 DONE 1.9s

#22 [stage-1 12/16] COPY --from=build /kotlin-compiler-server/executor.policy /kotlin-compiler-server/
#22 DONE 0.1s

#23 [stage-1 13/16] COPY --from=build /kotlin-compiler-server/indexes.json /kotlin-compiler-server/
#23 DONE 0.1s

#24 [stage-1 14/16] COPY --from=build /kotlin-compiler-server/indexesJs.json /kotlin-compiler-server/
#24 DONE 0.1s

#25 [stage-1 15/16] COPY --from=build /kotlin-compiler-server/indexesWasm.json /kotlin-compiler-server/
#25 DONE 0.1s

#26 [stage-1 16/16] COPY --from=build /kotlin-compiler-server/indexesComposeWasm.json /kotlin-compiler-server/
#26 DONE 0.1s

#27 exporting to image
#27 exporting layers
#27 exporting layers 3.7s done
#27 writing image sha256:e1f64f434b279715b1a3f88e545141fa67f493ffd2a0849b04c0af0412045b23 done
#27 naming to docker.io/library/my-image-name:1739937928 done
#27 DONE 3.7s

Run the image:

docker run -p 8080:8080 my-image-name:1739937928

Then the output shows:

OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::               (v2.7.10)

2025-02-19 04:23:29,157 INFO  [main] org.springframework.boot.StartupInfoLogger: Starting CompilerApplicationKt using Java 17.0.14 on 047aaaabb5a1 with PID 1 (/kotlin-compiler-server started by root in /kotlin-compiler-server)
2025-02-19 04:23:29,161 INFO  [main] org.springframework.boot.SpringApplication: No active profile set, falling back to 1 default profile: "default"
2025-02-19 04:23:30,586 INFO  [main] org.springframework.boot.web.embedded.tomcat.TomcatWebServer: Tomcat initialized with port(s): 8080 (http)
2025-02-19 04:23:30,597 INFO  [main] org.apache.juli.logging.DirectJDKLog: Initializing ProtocolHandler ["http-nio-8080"]
2025-02-19 04:23:30,598 INFO  [main] org.apache.juli.logging.DirectJDKLog: Starting service [Tomcat]
2025-02-19 04:23:30,598 INFO  [main] org.apache.juli.logging.DirectJDKLog: Starting Servlet engine: [Apache Tomcat/9.0.73]
2025-02-19 04:23:30,712 INFO  [main] org.apache.juli.logging.DirectJDKLog: Initializing Spring embedded WebApplicationContext
2025-02-19 04:23:30,713 INFO  [main] org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext: Root WebApplicationContext: initialization completed in 1480 ms
2025-02-19 04:23:31,038 WARN  [main] org.springframework.context.support.AbstractApplicationContext: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'completionProvider' defined in file [/kotlin-compiler-server/com/compiler/server/compiler/components/CompletionProvider.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'errorAnalyzer' defined in file [/kotlin-compiler-server/com/compiler/server/compiler/components/ErrorAnalyzer.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kotlinEnvironment' defined in class path resource [com/compiler/server/compiler/components/KotlinEnvironmentConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [component.KotlinEnvironment]: Factory method 'kotlinEnvironment' threw exception; nested exception is java.lang.NoSuchFieldError: MESSAGE_COLLECTOR_KEY
2025-02-19 04:23:31,042 INFO  [main] org.apache.juli.logging.DirectJDKLog: Stopping service [Tomcat]
2025-02-19 04:23:31,058 INFO  [main] org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2025-02-19 04:23:31,080 ERROR [main] org.springframework.boot.SpringApplication: Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'completionProvider' defined in file [/kotlin-compiler-server/com/compiler/server/compiler/components/CompletionProvider.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'errorAnalyzer' defined in file [/kotlin-compiler-server/com/compiler/server/compiler/components/ErrorAnalyzer.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kotlinEnvironment' defined in class path resource [com/compiler/server/compiler/components/KotlinEnvironmentConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [component.KotlinEnvironment]: Factory method 'kotlinEnvironment' threw exception; nested exception is java.lang.NoSuchFieldError: MESSAGE_COLLECTOR_KEY
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1303)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1292)
        at com.compiler.server.CompilerApplicationKt.main(CompilerApplication.kt:13)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'errorAnalyzer' defined in file [/kotlin-compiler-server/com/compiler/server/compiler/components/ErrorAnalyzer.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kotlinEnvironment' defined in class path resource [com/compiler/server/compiler/components/KotlinEnvironmentConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [component.KotlinEnvironment]: Factory method 'kotlinEnvironment' threw exception; nested exception is java.lang.NoSuchFieldError: MESSAGE_COLLECTOR_KEY
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:229)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1222)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        ... 19 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'kotlinEnvironment' defined in class path resource [com/compiler/server/compiler/components/KotlinEnvironmentConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [component.KotlinEnvironment]: Factory method 'kotlinEnvironment' threw exception; nested exception is java.lang.NoSuchFieldError: MESSAGE_COLLECTOR_KEY
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:658)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:486)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
        at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1391)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1311)
        at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:887)
        at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:791)
        ... 33 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [component.KotlinEnvironment]: Factory method 'kotlinEnvironment' threw exception; nested exception is java.lang.NoSuchFieldError: MESSAGE_COLLECTOR_KEY
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
        ... 47 common frames omitted
Caused by: java.lang.NoSuchFieldError: MESSAGE_COLLECTOR_KEY
        at component.KotlinEnvironment.createConfiguration(KotlinEnvironment.kt:128)
        at component.KotlinEnvironment.<init>(KotlinEnvironment.kt:88)
        at com.compiler.server.compiler.components.KotlinEnvironmentConfiguration.kotlinEnvironment(KotlinEnvironment.kt:29)
        at com.compiler.server.compiler.components.KotlinEnvironmentConfiguration$$EnhancerBySpringCGLIB$$35ec23b0.CGLIB$kotlinEnvironment$0(<generated>)
        at com.compiler.server.compiler.components.KotlinEnvironmentConfiguration$$EnhancerBySpringCGLIB$$35ec23b0$$FastClassBySpringCGLIB$$2739b8d2.invoke(<generated>)
        at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
        at com.compiler.server.compiler.components.KotlinEnvironmentConfiguration$$EnhancerBySpringCGLIB$$35ec23b0.kotlinEnvironment(<generated>)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:569)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
        ... 48 common frames omitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions