jooby icon indicating copy to clipboard operation
jooby copied to clipboard

Jooby console crashes with java.io.IOException

Open ruimaciel opened this issue 2 years ago • 1 comments

While following Jooby's Getting Started article, I've downloaded Download jooby-cli.zip, unzipped it, and ran 'jooby'. This resulted in jooby console crashing with the following exception:

rui@localhost:~/.jooby/bin$ ./jooby
Exception in thread "main" com.google.gson.JsonSyntaxException: java.io.IOException: Is a directory
        at com.google.gson.Gson.fromJson(Gson.java:1006)
        at com.google.gson.Gson.fromJson(Gson.java:929)
        at io.jooby.internal.cli.CommandContextImpl.<init>(CommandContextImpl.java:60)
        at io.jooby.cli.Cli.main(Cli.java:104)
Caused by: java.io.IOException: Is a directory
        at java.base/sun.nio.ch.FileDispatcherImpl.read0(Native Method)
        at java.base/sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:48)
        at java.base/sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:276)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:245)
        at java.base/sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:223)
        at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
        at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:107)
        at java.base/sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:101)
        at java.base/sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
        at java.base/sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
        at java.base/sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
        at java.base/java.io.InputStreamReader.read(InputStreamReader.java:181)
        at java.base/java.io.BufferedReader.fill(BufferedReader.java:161)
        at java.base/java.io.BufferedReader.read1(BufferedReader.java:212)
        at java.base/java.io.BufferedReader.read(BufferedReader.java:287)
        at com.google.gson.stream.JsonReader.fillBuffer(JsonReader.java:1290)
        at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1328)
        at com.google.gson.stream.JsonReader.consumeNonExecutePrefix(JsonReader.java:1605)
        at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:534)
        at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
        at com.google.gson.Gson.fromJson(Gson.java:987)
        ... 3 more

ruimaciel avatar May 27 '22 12:05 ruimaciel

It turns out the root cause of this crash was the fact that I unzipped the contents of jooby-cli.zip into ~/.jooby , which apparently jooby-cli expects to be a config file.

Renaming the dir to something else is enough to get jooby-cli to run as expected.

It might be worth considering handling config files in linux as per the XDG Base Directory Specification and stash them in the dir pointed to by $XDG_CONFIG_HOME or by default $HOME/.config.

ruimaciel avatar May 27 '22 12:05 ruimaciel