Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.RuntimeException: unsupported Java version: 9 #300

Open
andersonDadario opened this issue Nov 4, 2017 · 17 comments · May be fixed by #329
Open

java.lang.RuntimeException: unsupported Java version: 9 #300

andersonDadario opened this issue Nov 4, 2017 · 17 comments · May be fixed by #329

Comments

@andersonDadario
Copy link

Tried to use s3_website on Mac and unfortunately it does not run with Java 9

user$ s3_website push --dry-run
[info] Downloading https://github.com/laurilehmijoki/s3_website/releases/download/v3.4.0/s3_website.jar into /var/folders/pv/qhqsh1rj0r11dknn95w1yxbmvfy2z6/T//s3_website-3.4.0.jar
Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.jruby.Ruby.newInstance(Ruby.java:266)
	at s3.website.Ruby$.rubyRuntime$lzycompute(Ruby.scala:4)
	at s3.website.Ruby$.rubyRuntime(Ruby.scala:4)
	at s3.website.model.Config$$anonfun$15.apply(Config.scala:229)
	at s3.website.model.Config$$anonfun$15.apply(Config.scala:227)
	at scala.util.Try$.apply(Try.scala:192)
	at s3.website.model.Config$.erbEval(Config.scala:227)
	at s3.website.model.Site$$anonfun$2.apply(Site.scala:28)
	at s3.website.model.Site$$anonfun$2.apply(Site.scala:27)
	at scala.util.Success.flatMap(Try.scala:231)
	at s3.website.model.Site$.parseConfig(Site.scala:27)
	at s3.website.model.Site$.loadSite(Site.scala:100)
	at s3.website.Push$.push(Push.scala:62)
	at s3.website.Push$.main(Push.scala:40)
	at s3.website.Push.main(Push.scala)
Caused by: java.lang.RuntimeException: unsupported Java version: 9
	at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1878)
	at org.jruby.RubyInstanceConfig.<clinit>(RubyInstanceConfig.java:1585)
	... 15 more

Java version

user$ java --version
java 9.0.1
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
@laurilehmijoki
Copy link
Owner

Pull request highly appreciated!

@laurilehmijoki
Copy link
Owner

And thank you for the report :)

@andersonDadario
Copy link
Author

Btw @laurilehmijoki , thank you for s3 website. It`s a great project :)

@damnginamarketing
Copy link

damnginamarketing commented Nov 17, 2017

Also getting the same issue... would love to get this working as it would be my first time using it. Thank you!

——————

Downloading https://github.com/laurilehmijoki/s3_website/releases/download/v3.4.0/s3_website.jar into /Users/clementyeung/.gem/ruby/2.4.2/gems/s3_website-3.4.0/s3_website-3.4.0.jar Exception in thread "main" java.lang.ExceptionInInitializerError at org.jruby.Ruby.newInstance(Ruby.java:266) at s3.website.Ruby$.rubyRuntime$lzycompute(Ruby.scala:4) at s3.website.Ruby$.rubyRuntime(Ruby.scala:4) at s3.website.model.Config$$anonfun$15.apply(Config.scala:229) at s3.website.model.Config$$anonfun$15.apply(Config.scala:227) at scala.util.Try$.apply(Try.scala:192) at s3.website.model.Config$.erbEval(Config.scala:227) at s3.website.model.Site$$anonfun$2.apply(Site.scala:28) at s3.website.model.Site$$anonfun$2.apply(Site.scala:27) at scala.util.Success.flatMap(Try.scala:231) at s3.website.model.Site$.parseConfig(Site.scala:27) at s3.website.model.Site$.loadSite(Site.scala:100) at s3.website.Push$.push(Push.scala:62) at s3.website.Push$.main(Push.scala:40) at s3.website.Push.main(Push.scala) Caused by: java.lang.RuntimeException: unsupported Java version: 9 at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1878) at org.jruby.RubyInstanceConfig.<clinit>(RubyInstanceConfig.java:1585) ... 15 more

java --version java 9.0.1 Java(TM) SE Runtime Environment (build 9.0.1+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

@laurilehmijoki
Copy link
Owner

A workaround is to use jenv: #298

@alandipert
Copy link

alandipert commented Nov 28, 2017

Could this be as simple as upgrading JRuby in build.sbt?

jruby/jruby#4558 (comment)

@lucascantor
Copy link

My experience figuring out how to use jenv as a workaround, for anyone having trouble:

#298 (comment)

@andersonDadario
Copy link
Author

I just used Docker, problem solved.

Here is what I did:

  1. Created a s3_website directory on my app root directory
  2. There I created 3 files:

Dockerfile

FROM ruby:2.3.3

RUN apt-get update -qq && \
    apt-get install --assume-yes -y \
       build-essential \
       libpq-dev \
       openjdk-7-jre \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Use en_US.UTF-8 as our locale
ENV LC_CTYPE en_US.UTF-8
ENV LANG en_US.UTF-8

# Run bundle
RUN gem install s3_website && s3_website install

RUN mkdir /app
VOLUME /app
WORKDIR /app

CMD bash

build.sh

#!/bin/bash
docker build -t utils/s3_website .

deploy.sh

#!/bin/bash

docker run --rm \
    --name s3_website \
    -it \
    -v "$(cd .. && pwd):/app" \
    utils/s3_website \
    s3_website push

And I still keep the s3_website.yml file in my app root folder. The app container will access it through a shared volume.

The process is simple:

  1. Install Docker
  2. $ bash build.sh # just need to do it once to create the image
  3. $ bash deploy.sh # loads info from ../s3_website.yml

Note: I am sure that this process can be optimized, e.g., let --dry-run be parameter for deploy.sh, but so far it works well for me.

@xaviershay
Copy link
Contributor

xaviershay commented Jul 26, 2018

I tried and failed to make a PR to fix. I know basically nothing about Scala or Java, so no real surprise. Notes:

  • Tried to run ./sbt assembly, failed with error around Missing dependency 'object java.lang.Object in compiler mirror'. Googling seems to suggest this is likely a result of sbt being too old for java 9 (0.13.2).
  • Tried to replace project/sbt-launch.jar with 0.13.7 downloaded from SBT website. Failed with error module not found: org.scala-sbt#sbt;0.13.17. This appears to be same actual error as Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty #312, workaround posted there. Command now works, but "assembly" not a valid command.
  • Switched to a project I have an pointed it at local s3_website with path: option in bundler. Still getting error: scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found. when trying to publish.
  • Turns out something created project/build.properties which was locking SBT version (./sbt sbtVersion) to 0.13. Updated that to 1.1.6 (latest). No cannot resolve sbt-assembly and sbt-idea dependencies, pretty sure those are specified somewhere in this project.
  • Updated sbt-assembly to latest and removed sbt-idea (for now). Commented out code to fix error: not found: object AssemblyKeys (this will very likely burn me later), sbtVersion now reports 1.1.6.
  • publishing still results in object java.lang.Object in compiler mirror not found :(

@natseg
Copy link

natseg commented Aug 6, 2018

#300 (comment) I would also recommend using asdf to manage different versions of java on your mac. It's a meta manager so it can also manage ruby, nodejs, elixir, erlang, ...

That's how I "fixed" this issue on my machine.

@AndrewKvalheim
Copy link

For searchability:

Caused by: java.lang.RuntimeException: unsupported Java version: 10

@rtrvrtg
Copy link

rtrvrtg commented Oct 10, 2018

Got a colleague with the same problem except their runtime exception message is unsupported Java version: 11

Your build dependencies currently indicate that jRuby 1.7.11 is required. jRuby's Github indicates that the latest versions support up to v10: https://github.com/jruby/jruby/blob/ce15c9d63e7312c47c7d86c2852e93a406459c7b/core/src/main/java/org/jruby/RubyInstanceConfig.java

@losomo
Copy link

losomo commented Dec 13, 2018

For my future self:
Problem:

Caused by: java.lang.RuntimeException: unsupported Java version: 11
	at org.jruby.RubyInstanceConfig.initGlobalJavaVersion(RubyInstanceConfig.java:1878)

Solution:

PATH=/usr/lib/jvm/java-8-openjdk-amd64/bin/:$PATH s3_website push

@xaviershay
Copy link
Contributor

Can confirm that @losomo's workaround worked for me on Ubuntu 18.04 with openjdk-8-jre-headless package installed.

> lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic
> dpkg -S /usr/lib/jvm/java-1.8.0-openjdk-amd64     
openjdk-8-jre-headless:amd64: /usr/lib/jvm/java-1.8.0-openjdk-amd64

@cpury
Copy link

cpury commented Feb 7, 2019

So which Java versions are supported? Can we at least mention that in the Readme? I'd hate to download and install one after the other until I hit one that's supported...

@nadnoslen
Copy link

I ended up brewing down to adoptopenjdk8 (Java 8) in order to get this plugin to work.

Annoying because I had to completely uninstall adoptopenjdk11.

I'm stunned that there is a Java dependency locked at 8? I wonder if @alandipert upgrade of JRuby comment would fix this.

@yanokwa yanokwa linked a pull request Aug 9, 2019 that will close this issue
@yanokwa
Copy link
Contributor

yanokwa commented Aug 9, 2019

I've sent in #329 that should allow our beloved s3_website on recent versions of Java. I would love a review!

facebook-github-bot pushed a commit to facebook/flow that referenced this issue May 29, 2020
Summary:
we use `s3_website` to push the site to S3. turns out it doesn't support Java 11 yet (laurilehmijoki/s3_website#300) so I updated our docker image to use Java 8.

also fixed a deprecation warning about using `bundle install --path`, and fixed a related cwd issue with calling `bundle exec` from outside `website/`.

Reviewed By: jbrown215

Differential Revision: D21786250

fbshipit-source-id: 21e01836e6d2cc8b7e33aac992533f1a7153ecdc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.