2

I'm deploying a JavaEE app in a Wildfly running in a Docker container. This app uses the GraalVM to run a R script. The environment is set to use the GraalVM with Java 11, but when I execute the script, I'm getting the error: "A language with id 'R' is not installed. Installed languages are: []." That is my pom.xml:

<!-- R Language -->
    <dependency>
        <groupId>org.graalvm.sdk</groupId>
        <artifactId>graal-sdk</artifactId>
        <version>19.3.1</version>
    </dependency>
    <dependency>
        <groupId>org.graalvm.truffle</groupId>
        <artifactId>truffle-api</artifactId>
        <version>19.3.1</version>
    </dependency>

That is the script call, which returns a svg file:

try(var ctx = org.graalvm.polyglot.Context.newBuilder().allowAllAccess(true).build()) {
        var source = Source.newBuilder("R", new File("/opt/jboss/plot.R")).build();
        return ok(ctx.eval(source).as(Function.class).apply(ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage())).build();
    }

Any idea what is going on?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38

2 Answers2

0

You don't really need the sdk and truffle as dependencies if you are using GraalVM, and putting Truffle on the classpath actually breaks certain assumptions and likely causes your issue. Try removing truffle from your dependencies.

BoriS
  • 907
  • 5
  • 13
  • 3
    If i remove the truffle from my dependencies, i get the error: "No language and polyglot implementation was found on the class path. Make sure the truffle-api.jar is on the classpath." – João Victor Feb 07 '20 at 11:50
  • Are you, in fact, running on GraalVM? – BoriS Feb 08 '20 at 16:26
0

Below I gave a variant how you can try to fix such issue. Question is related to JS component by you can do that same for R lang.

https://stackoverflow.com/a/75101320/564413

blandger
  • 718
  • 7
  • 17