Search code examples
rdockerwildflygraalvmjava-ee-8

Error: A language with id 'R' is not installed. Installed languages are: []


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?


Solution

  • 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