ContextMapper / context-mapper-dsl

ContextMapper DSL: A Domain-specific Language for Context Mapping & Service Decomposition
https://contextmapper.org/
Apache License 2.0
224 stars 30 forks source link

The CML Language Server server crashed 5 times #290

Closed oweidner closed 1 year ago

oweidner commented 3 years ago

I am having problems getting the VS Code plugin to work:

The error message I get is The CML Language Server server crashed 5 times in the last 3 minutes. The server will not be restarted.

The console output looks like this:

Exception in thread "main" com.google.inject.internal.util.$ComputationException: com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError
    at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
    at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
    at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:50)
    at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
    at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:125)
    at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:521)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:847)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:772)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:256)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:205)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:853)
    at com.google.inject.internal.BoundProviderFactory.notify(BoundProviderFactory.java:44)
    at com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:133)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
    at com.google.inject.Guice.createInjector(Guice.java:95)
    at com.google.inject.Guice.createInjector(Guice.java:72)
    at com.google.inject.Guice.createInjector(Guice.java:62)
    at org.eclipse.xtext.ide.server.ServerLauncher.launch(ServerLauncher.java:47)
    at org.eclipse.xtext.ide.server.ServerLauncher.main(ServerLauncher.java:42)
Caused by: com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError
    at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
    at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
    at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:50)
    at com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:65)
    at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:73)
    at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:28)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:36)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:32)
    at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:39)
    at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:549)
    ... 20 more
Caused by: java.lang.ExceptionInInitializerError
    at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:67)
    at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:72)
    at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
    at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:216)
    at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:64)
    at com.google.inject.internal.BytecodeGen.newFastClass(BytecodeGen.java:207)
    at com.google.inject.internal.SingleMethodInjector.createMethodInvoker(SingleMethodInjector.java:49)
    at com.google.inject.internal.SingleMethodInjector.<init>(SingleMethodInjector.java:38)
    at com.google.inject.internal.MembersInjectorStore.getInjectors(MembersInjectorStore.java:125)
    at com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:95)
    at com.google.inject.internal.MembersInjectorStore.access$000(MembersInjectorStore.java:34)
    at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:42)
    at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:39)
    at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:39)
    at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:549)
    ... 30 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 @40f9161a
    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 com.google.inject.internal.cglib.core.$ReflectUtils$2.run(ReflectUtils.java:56)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
    at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:46)
    ... 45 more
[Info  - 10:13:27 AM] Connection to server got closed. Server will restart.
oweidner commented 3 years ago

It seems that this issue is specific to Orcale's JDK. With OpenJDK the extension / language server launches just fine. However, I still see a warning hinting at a similar problem:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 (file:/Users/architeuthis/.vscode/extensions/contextmapper.context-mapper-vscode-extension-6.5.0/lsp/lib/guice-3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
java -version
openjdk version "15.0.2" 2021-01-19
OpenJDK Runtime Environment (build 15.0.2+7)
OpenJDK 64-Bit Server VM (build 15.0.2+7, mixed mode, sharing)
stefan-ka commented 3 years ago

Thanks for reporting this issue @oweidner; good to know that this is a problem with Oracle's JDK. I'm aware of the warning you mentioned above. Unfortunately, this is a problem in the Xtext framework. I don't know if the @xtext guys already fixed this in a newer version; but I will check.

evgeniykim commented 3 years ago

I am having same problem but with OpenJDK. VS Code info:

java -version
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment (build 16.0.1+9-24)
OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
therealjawss commented 3 years ago

Also the same with version 16 openjdk version "17" 2021-09-14 OpenJDK Runtime Environment (build 17+35-2724) OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)

update: finally got it working by installing just version 15 openjdk 15 2020-09-15 OpenJDK Runtime Environment (build 15+36-1562) OpenJDK 64-Bit Server VM (build 15+36-1562, mixed mode, sharing)

evgeniykim commented 3 years ago

For those who does not want install JDK 15 to run this extension, I found workaround for JDK 16 using infromation from here https://stackoverflow.com/questions/41265266/how-to-solve-inaccessibleobjectexception-unable-to-make-member-accessible-m What I did was changing how vs-code extension starts in %USERPROFILE%.vscode\extensions\contextmapper.context-mapper-vscode-extension-6.5.2\lsp\bin\context-mapper-lsp.bat by adding --add-opens java.base/java.lang=ALL-UNNAMED:

@rem Execute context-mapper-lsp
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %CONTEXT_MAPPER_LSP_OPTS% --add-opens java.base/java.lang=ALL-UNNAMED -classpath "%CLASSPATH%" org.eclipse.xtext.ide.server.ServerLauncher %CMD_LINE_ARGS%
vancluever commented 2 years ago

Note that you can also export the --add-opens java.base/java.lang=ALL-UNNAMED flag to CONTEXT_MAPPER_LSP_OPTS in your respective environment to avoid having to edit files the extension that may be reverted at a later date.

karimElJed commented 2 years ago

Just hit the same issue on Windows and also on Mac. The workaround from @evgeniykim does not help in my case. Is there any other known workaround?

stefan-ka commented 1 year ago

Hi @oweidner, @karimElJed, @vancluever, @evgeniykim, @therealjawss Today we released v6.7.0 of Context Mapper that finally supports Java 17: https://contextmapper.org/news/2022/12/02/v6.7.0-released/ From my perspective this issue should be solved, so I'll close it. If you still experience issues, feel free to re-open or create other issues. Best regards, Stefan