bazel: java 1.8.0_162: java.util.MissingResourceException: Can't find bundle for base name com.google.errorprone.errors, locale en_US

Description of the problem / feature request:

On OSX, with java 1.8.0_162-b12 from Oracle, running bazel 0.9.0 -without-jdk installed via self-extractor or homebrew fails with an error. Earlier Java update versions work fine (e.g. u131). Bazel 0.9.0 with bundled JDK also works fine.

Error:

(09:04:29) ERROR: /Volumes/code/redfin/main/redfin.core.enums/BUILD:4:1: Building redfin.core.enums/libredfin.core.enums.jar (533 source files) failed (Exit 1): java failed: error executing command
  (cd /private/var/tmp/_bazel_robert.gay/69746c6b963d631c63554f7e842731c0/execroot/redfin_main && \
  exec env - \
    LC_CTYPE=en_US.UTF-8 \
  external/local_jdk/bin/java -XX:+TieredCompilation '-XX:TieredStopAtLevel=1' -Xbootclasspath/p:external/bazel_tools/third_party/java/jdk/langtools/javac-9-dev-r4023-3.jar -jar external/bazel_tools/tools/jdk/JavaBuilder_deploy.jar @bazel-out/darwin-fastbuild/bin/redfin.core.enums/libredfin.core.enums.jar-2.params)
java.lang.InternalError: Cannot find requested resource bundle for locale en_US
        at com.sun.tools.javac.util.JavacMessages.getBundles(JavacMessages.java:128)
        at com.sun.tools.javac.util.JavacMessages.getLocalizedString(JavacMessages.java:147)
        at com.sun.tools.javac.util.JavacMessages.getLocalizedString(JavacMessages.java:140)
        at com.sun.tools.javac.util.Log.localize(Log.java:788)
        at com.sun.tools.javac.util.Log.printLines(Log.java:586)
        at com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:170)
        at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
        at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:90)
        at com.google.devtools.build.buildjar.javac.BlazeJavacMain.compile(BlazeJavacMain.java:107)
        at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder$1.invokeJavac(SimpleJavaLibraryBuilder.java:105)
        at com.google.devtools.build.buildjar.ReducedClasspathJavaLibraryBuilder.compileSources(ReducedClasspathJavaLibraryBuilder.java:54)
        at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.compileJavaLibrary(SimpleJavaLibraryBuilder.java:108)
        at com.google.devtools.build.buildjar.SimpleJavaLibraryBuilder.run(SimpleJavaLibraryBuilder.java:116)
        at com.google.devtools.build.buildjar.BazelJavaBuilder.processRequest(BazelJavaBuilder.java:105)
        at com.google.devtools.build.buildjar.BazelJavaBuilder.runPersistentWorker(BazelJavaBuilder.java:67)
        at com.google.devtools.build.buildjar.BazelJavaBuilder.main(BazelJavaBuilder.java:45)
Caused by: java.util.MissingResourceException: Can't find bundle for base name com.google.errorprone.errors, locale en_US
        at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1573)
        at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396)
        at java.util.ResourceBundle.getBundle(ResourceBundle.java:854)
        at com.sun.tools.javac.util.JavacMessages.lambda$add$0(JavacMessages.java:106)
        at com.sun.tools.javac.util.JavacMessages.getBundles(JavacMessages.java:125)
        ... 15 more
  • Install bazel 0.9.0-without-jdk, or via homebrew
  • Install Java 1.8_162
  • Set JAVA_HOME to 1.8_162
  • bazel shutdown (just to ensure bazel is started w/ Java 1.8_162 in the next step)
  • bazel build <any java_* target> fails with the above error.

bazel shutdown + switching JAVA_HOME back to an earlier Java update + bazel build will succeed.

What operating system are you running Bazel on?

OSX Sierra

What’s the output of bazel info release?

release 0.9.0

Have you found anything relevant by searching the web?

Nothing obviously relevant to bazel

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 24 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I’m hitting the same problem on RHEL6 with the same version of Java and bazel. Switching back to jdk1.8.0_152 solved the issue.

Alright, I managed to resolved it, here is what I did (on MacOS Sierra 10.21.6):

  1. Uninstall jdk1.8.0_161.jdk
  2. Install jdk1.8.0_152.jdk
  3. Uninstall bazel 0.9.0-homebrew
  4. Reinstall bazel 0.9.0-homebrew
  5. It doesn’t matter what $JAVA_HOME is set to, it seems when bazel is installed it sets java-home to the latest version of jdk.
  6. Try to run $ bazel info java-home:
$ bazel info java-home
/Library/Java/JavaVirtualMachines/jdk1.8.0_152.jdk/Contents/Home/jre

Thanks, I tried bazel shutdown but it doesn’t work and bazel info java-home still shows the wrong version of jdk.

The fix is cherry picked for bazel 0.10.0. It will be released next week.

Test bazel shutdown and rebuild the project. It worked for me

@cushon why did you re-open it? If I use Bazel HEAD then it’s resolved?

Ditto on Debian Jessie. bazel info release -> release 0.9.0. java -version ->

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