NiccoMlt / Protelis-Web

Web server for Protelis frontends
GNU General Public License v3.0
1 stars 0 forks source link

Protelis-related IllegalArgumentException on Shadow JAR #14

Closed NiccoMlt closed 4 years ago

NiccoMlt commented 4 years ago

When running code with runShadow Gradle task (provided by Vert.x plugin for Gradle and using Gradle Shadow plugin), during simulation creation IllegalArgumentException is thrown:

Exception in thread "DefaultDispatcher-worker-2" java.lang.IllegalArgumentException: Could not create the requested Protelis program: eval(env.get("_to_exec")) at it.unibo.alchemist.model.ProtelisIncarnation.createAction(ProtelisIncarnation.java:135) at it.unibo.alchemist.model.ProtelisIncarnation.createReaction(ProtelisIncarnation.java:208) at it.unibo.alchemist.loader.YamlLoader.lambda$getWith$22(YamlLoader.java:589) at it.unibo.alchemist.loader.YamlLoader$BuilderConfiguration.lambda$build$0(YamlLoader.java:864) at it.unibo.alchemist.loader.YamlLoader$BuilderConfiguration.ifMap(YamlLoader.java:872) at it.unibo.alchemist.loader.YamlLoader$BuilderConfiguration.build(YamlLoader.java:850) at it.unibo.alchemist.loader.YamlLoader$Builder.build(YamlLoader.java:830) at it.unibo.alchemist.loader.YamlLoader.getWith(YamlLoader.java:591) at it.unibo.alchemist.loader.YamlLoader.getDefault(YamlLoader.java:398) at it.unibo.protelis.web.execution.simulated.SimulatedProtelisEngine$setupSimulationAsync$1.invokeSuspend(SimulatedProtelisEngine.kt:66) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:561) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:727) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:667) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:655) Caused by: java.util.MissingResourceException: The string resource '_UI_DiagnosticRoot_diagnostic' could not be located Caused by: java.util.MissingResourceException: The string resource '_UI_DiagnosticRoot_diagnostic' could not be located

at org.eclipse.emf.common.util.DelegatingResourceLocator.delegatedGetString(DelegatingResourceLocator.java:480) at org.eclipse.emf.common.util.DelegatingResourceLocator.getString(DelegatingResourceLocator.java:385) at org.eclipse.emf.common.util.DelegatingResourceLocator.getString(DelegatingResourceLocator.java:499) at org.eclipse.emf.common.util.DelegatingResourceLocator.getString(DelegatingResourceLocator.java:491) at org.eclipse.emf.ecore.util.Diagnostician.createDefaultDiagnostic(Diagnostician.java:88) at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:107) at org.protelis.lang.ProtelisLoader.parse(ProtelisLoader.java:268) at org.protelis.lang.ProtelisLoader.parseAnonymousModule(ProtelisLoader.java:338) at org.protelis.lang.ProtelisLoader.lambda$parse$5(ProtelisLoader.java:317) at java.base/java.util.Optional.orElseGet(Optional.java:369) at org.protelis.lang.ProtelisLoader.parse(ProtelisLoader.java:317) at it.unibo.alchemist.model.implementations.actions.RunProtelisProgram.(RunProtelisProgram.java:123) at it.unibo.alchemist.model.implementations.actions.RunProtelisProgram.(RunProtelisProgram.java:96) at it.unibo.alchemist.model.ProtelisIncarnation.createAction(ProtelisIncarnation.java:133) ... 15 more

This error does not happen when code is run with vertxRun task, so it's probably related to something missing in packetized shadow JAR.

NiccoMlt commented 4 years ago

I got this hint by email from professor:

Sembra un problema con gli internals di Xtext. Forse manca qualche risorsa nel classpath

sì, parrebbe... https://stackoverflow.com/questions/38043360/error-when-validating-xtext-dsl-in-standalone-java-project

I also think these solutions could be helpful for my issue: