Search code examples
gremlinjanusgraph

Error while running JanusGraph Gremlin console


I am following the steps mentioned here: http://docs.janusgraph.org/latest/getting-started.html and getting error while running the command: bin/gremlin.sh

Error Trace:

Exception in thread "main" java.io.UnsupportedEncodingException: UTF-8i
    at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:61)
    at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:100)
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:231)
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
    at jline.console.ConsoleReader.<init>(ConsoleReader.java:213)
    at org.codehaus.groovy.tools.shell.PatchedConsoleReader.<init>(PatchedConsoleReader.groovy:32)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at org.codehaus.groovy.tools.shell.InteractiveShellRunner.<init>(InteractiveShellRunner.groovy:50)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at org.apache.tinkerpop.gremlin.console.Console.<init>(Console.groovy:118)
    at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:232)
    at org.apache.tinkerpop.gremlin.console.Console.main(Console.groovy:478)

I am using following java version:

java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

Can anyone tell me how should I avoid this error and start working on JanusGraph?


Solution

  • From your stack trace, it looks like the encoding is set to UTF-8i, which is not a valid value. See StandardCharsets for typical values. Check your LC_CTYPE environment variable or JAVA_OPTIONS to see if it attempts to override input.encoding or file.encoding.

    For example, this recreates the stack trace above:

    $ export JAVA_OPTIONS=-Dinput.encoding=UTF-8i
    $ bin/gremlin.sh
    
             \,,,/
             (o o)
    -----oOOo-(3)-oOOo-----
    Exception in thread "main" java.io.UnsupportedEncodingException: UTF-8i
        at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:61)
        at java.io.OutputStreamWriter.<init>(OutputStreamWriter.java:100)
        at jline.console.ConsoleReader.<init>(ConsoleReader.java:231)
        at jline.console.ConsoleReader.<init>(ConsoleReader.java:221)
        at jline.console.ConsoleReader.<init>(ConsoleReader.java:213)
        etc...
    

    Unsetting the JAVA_OPTIONS variable makes it work again:

    $ unset JAVA_OPTIONS
    $ bin/gremlin.sh
    
             \,,,/
             (o o)
    -----oOOo-(3)-oOOo-----
    plugin activated: janusgraph.imports
    plugin activated: tinkerpop.server
    plugin activated: tinkerpop.utilities
    plugin activated: tinkerpop.hadoop
    plugin activated: tinkerpop.spark
    plugin activated: tinkerpop.tinkergraph
    gremlin>