mbeddr / mps-build-backends

Command-line utilities used e.g. by Gradle plugins to generate or check models.
Apache License 2.0
3 stars 4 forks source link

Required JDK version? #18

Closed tomb50 closed 5 months ago

tomb50 commented 6 months ago

Hello,

What JDK versions are needed to use this? I'm looking to make use of this from a maven project (using exec/java mojo) - but getting a couple of errors when it is starting MPS - pasted below.

The below is when running with JDK 17.0.7-tem

2024-03-18 11:30:59,194 INFO - jetbrains.mps.tool.environment.IdeaEnvironment - Creating IDEA environment 2024-03-18 11:30:59,194 INFO - jetbrains.mps.tool.environment.IdeaEnvironment - Creating IdeaCmdApplication 2024-03-18 11:30:59,250 [ 3] INFO - #c.i.i.AppStarter - ------------------------------------------------------ IDE STARTED ------------------------------------------------------ 2024-03-18 11:30:59,257 [ 10] WARN - #c.i.i.AppStarter - Unable to load JNA library (os=Linux 6.5.0-25-generic, jna.boot.library.path=null) java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native at com.intellij.jna.JnaLoader.load(JnaLoader.java:19) at com.intellij.idea.StartupUtil$loadSystemLibsAndLogInfoAndInitMacApp$1$2.invokeSuspend(StartupUtil.kt:319) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42) at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.UnsatisfiedLinkError: Native library (com/sun/jna/linux-x86-64/libjnidispatch.so) not found in resource path ([file:/home/icon0195/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-common/1.6.10/kotlin-stdlib-common-1.6.10.jar, file:/home/icon0195/.m2/repository/com/xenomachina/xenocom/0.0.7/xenocom-0.0.7.jar, file:/home/icon0195/.m2/repository/de/itemis/mps/build-backends/execute-generators/1.14.3.77.c46b31e/execute-generators-1.14.3.77.c46b31e.jar, file:/home/icon0195/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.6.10/kotlin-stdlib-jdk8-1.6.10.jar, file:/home/icon0195/.m2/repository/de/itemis/mps/build-backends/project-loader/2.2.0.77.c46b31e/project-loader-2.2.0.77.c46b31e.jar, file:/home/icon0195/.m2/repository/org/apache/commons/commons-exec/1.4.0/commons-exec-1.4.0.jar, file:/home/icon0195/.m2/repository/com/xenomachina/kotlin-argparser/2.0.7/kotlin-argparser-2.0.7.jar, file:/home/icon0195/.m2/repository/org/codehaus/plexus/plexus-utils/4.0.0/plexus-utils-4.0.0.jar, file:/home/icon0195/.m2/repository/org/ow2/asm/asm/9.6/asm-9.6.jar, file:/home/icon0195/.m2/repository/org/ow2/asm/asm-tree/9.6/asm-tree-9.6.jar, file:/home/icon0195/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.6.10/kotlin-stdlib-1.6.10.jar, file:/home/icon0195/.m2/repository/org/apache/maven/resolver/maven-resolver-util/1.4.1/maven-resolver-util-1.4.1.jar, file:/home/icon0195/.m2/repository/org/codehaus/plexus/plexus-xml/3.0.0/plexus-xml-3.0.0.jar, file:/home/icon0195/.m2/repository/org/apache/maven/resolver/maven-resolver-api/1.4.1/maven-resolver-api-1.4.1.jar, file:/home/icon0195/.m2/repository/org/ow2/asm/asm-commons/9.6/asm-commons-9.6.jar, file:/home/icon0195/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.10/kotlin-stdlib-jdk7-1.6.10.jar, file:/home/icon0195/.m2/repository/org/codehaus/mojo/exec-maven-plugin/3.2.0/exec-maven-plugin-3.2.0.jar, file:/home/icon0195/.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar, file:/home/icon0195/repos/ipf-tutorial/solutions/add-ht at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1059) at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:1015) at com.sun.jna.Native.(Native.java:221) at kotlinx.coroutines.repackaged.net.bytebuddy.agent.VirtualMachine$ForHotSpot$Connection$ForJnaPosixSocket$Factory.(VirtualMachine.java:877) at kotlinx.coroutines.repackaged.net.bytebuddy.agent.VirtualMachine$ForHotSpot$Connection$ForJnaPosixSocket$Factory.withDefaultTemporaryFolder(VirtualMachine.java:908) at kotlinx.coroutines.repackaged.net.bytebuddy.agent.VirtualMachine$ForHotSpot.attach(VirtualMachine.java:243) 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:568) at kotlinx.coroutines.repackaged.net.bytebuddy.agent.Attacher.install(Attacher.java:106) at kotlinx.coroutines.repackaged.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:608) at kotlinx.coroutines.repackaged.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:586) at kotlinx.coroutines.repackaged.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:538) at kotlinx.coroutines.debug.internal.ByteBuddyDynamicAttach.attach(Attach.kt:21) at kotlinx.coroutines.debug.internal.ByteBuddyDynamicAttach.invoke(Attach.kt:17) at kotlinx.coroutines.debug.internal.ByteBuddyDynamicAttach.invoke(Attach.kt:15) at kotlinx.coroutines.debug.internal.DebugProbesImpl.install(DebugProbesImpl.kt:85) at kotlinx.coroutines.debug.DebugProbes.install(DebugProbes.kt:72) at com.intellij.diagnostic.CoroutineDumperKt.enableCoroutineDump(coroutineDumper.kt:22) at com.intellij.idea.StartupUtil$startApplication$4.invokeSuspend(StartupUtil.kt:202) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ... 4 more 2024-03-18 11:30:59,277 [ 30] INFO - #c.i.i.p.PluginManager - Plugin PluginDescriptor(name=MPS Build Languages, id=jetbrains.mps.build, descriptorPath=plugin.xml, path=~/repos/ipf-tutorial/solutions/add-http/domain-root/mps/target/mps/plugins/mps-build, version=2022.3.1, package=null, isBundled=true) misses optional descriptor pluginSolutions.xml 2024-03-18 11:30:59,363 [ 116] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - Unhandled exception in [StandaloneCoroutine{Cancelling}@7b36934a, Dispatchers.Default] java.lang.IllegalAccessError: class com.intellij.idea.StartupUtil$initAwtToolkit$1$1 (in unnamed module @0x4e0726a6) cannot access class sun.awt.AWTAutoShutdown (in module java.desktop) because module java.desktop does not export sun.awt to unnamed module @0x4e0726a6 at com.intellij.idea.StartupUtil$initAwtToolkit$1$1.invokeSuspend(StartupUtil.kt:495) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664) 2024-03-18 11:30:59,364 [ 117] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - JetBrains MPS 2022.3.1 Build #MPS-223.8836.1366 2024-03-18 11:30:59,365 [ 118] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - JDK: 17.0.7; VM: OpenJDK 64-Bit Server VM; Vendor: Eclipse Adoptium 2024-03-18 11:30:59,366 [ 119] SEVERE - #c.i.o.a.i.CoroutineExceptionHandlerImpl - OS: Linux 2024-03-18 11:32:39,215 [ 99968] INFO - STDERR - execute-generators: generation failed

tomb50 commented 6 months ago

I made progress by adding a whole bunch of adds-open and adds-export to the java process.

MAVEN_OPTS=--add-opens=java.desktop/java.awt.event=ALL-UNNAMED --add-opens=java.desktop/sun.font=ALL-UNNAMED --add-opens=java.desktop/java.awt=ALL-UNNAMED --add-opens=java.desktop/sun.awt=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/sun.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED --add-exports=java.desktop/sun.font=ALL-UNNAMED --add-exports=java.desktop/sun.java2d=ALL-UNNAMED --add-exports=java.desktop/sun.awt.windows=ALL-UNNAMED --add-exports=java.desktop/sun.awt.image=ALL-UNNAMED --add-opens=java.desktop/sun.awt.windows=ALL-UNNAMED

I get to the point now where i can see the project being loaded but it is not identifying any models to generate - I'll continue with that, but it would be good to know if I should be needing to do the above

tomb50 commented 5 months ago

Closing as, after asking Sergej on slack I was made aware that project loader also does the same to resolve the same issue