Open Bug 1451447 Opened 6 years ago Updated 2 years ago

mach bootstrap and build fails to run when Java 9/10 is installed: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

Categories

(Firefox Build System :: Bootstrap Configuration, defect, P4)

defect

Tracking

(Not tracked)

People

(Reporter: whimboo, Unassigned)

References

Details

I run the `mach bootstrap` command for a Fennec artifact build and it failed:

We are now installing the following Android packages:
platform-tools
build-tools;26.0.2
platforms;android-23
extras;android;m2repository
extras;google;m2repository
emulator

You may be prompted to agree to the Android license. You may see some of
output as packages are downloaded and installed.

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
	at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156)
	at com.android.repository.api.SchemaModule.<init>(SchemaModule.java:75)
	at com.android.sdklib.repository.AndroidSdkHandler.<clinit>(AndroidSdkHandler.java:81)
	at com.android.sdklib.tool.SdkManagerCli.main(SdkManagerCli.java:103)
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlSchema
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
	... 4 more
Error running mach:

    ['bootstrap']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.

You should consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

CalledProcessError: Command '['/Volumes/data/Users/henrik/.mozbuild/android-sdk-macosx/tools/bin/sdkmanager', '--package_file=/Volumes/data/code/gecko/python/mozboot/mozboot/android-packages.txt']' returned non-zero exit status 1

  File "/Volumes/data/code/gecko/python/mozboot/mozboot/mach_commands.py", line 32, in bootstrap
    bootstrapper.bootstrap()
  File "/Volumes/data/code/gecko/python/mozboot/mozboot/bootstrap.py", line 297, in bootstrap
    getattr(self.instance, 'install_%s_packages' % application)()
  File "/Volumes/data/code/gecko/python/mozboot/mozboot/osx.py", line 206, in install_mobile_android_artifact_mode_packages
    self.package_manager)(artifact_mode=True)
  File "/Volumes/data/code/gecko/python/mozboot/mozboot/osx.py", line 380, in ensure_homebrew_mobile_android_packages
    no_interactive=self.no_interactive)
  File "/Volumes/data/code/gecko/python/mozboot/mozboot/android.py", line 191, in ensure_android
    ensure_android_packages(sdkmanager_tool=sdkmanager_tool, no_interactive=no_interactive)
  File "/Volumes/data/code/gecko/python/mozboot/mozboot/android.py", line 247, in ensure_android_packages
    subprocess.check_call(args)
  File "/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 186, in check_call
    raise CalledProcessError(retcode, cmd)
First I tried to build:

> $ mach build
>[..]
> 0:05.27 DEBUG: configure: error: You must install the Android build-tools version 26.0.2.  Try |mach bootstrap|.  (Looked for /Volumes/data/Users/henrik/.mozbuild/android-sdk-macosx/build-tools/26.0.2)

Then I tried `mach bootstrap` as suggested.

Currently I have:

> $ ls /Volumes/data/Users/henrik/.mozbuild/android-sdk-macosx/build-tools/
> 23.0.3

So if I have to install the build-tools 26.0.2 myself the hint with `mach bootstrap` is wrong.
Ok, so the problem is that I had Java SE 10 installed on my MacBook and that this installation was picked up to run the sdkmanager. As several web pages explain Java 9 and 10 aren't working, and you should go back to Java 8. 

After uninstalling Java 10 JDK, `mach bootstrap` is working now.

So we should check the version of javac and make sure to not allow Java 9 and 10 for now?
Summary: CalledProcessError: Command '['.mozbuild/android-sdk-macosx/tools/bin/sdkmanager', '--package_file=python/mozboot/mozboot/android-packages.txt']' returned non-zero exit status 1 → "mach bootstrap" fails to run for "Android Artifact Mode" when Java 9/10 is installed: CalledProcessError: Command '['sdkmanager', '--package_file=python/mozboot/mozboot/android-packages.txt']' returned non-zero exit status 1
Priority: -- → P4
Component: Mach Core → Bootstrap Configuration
doesn't work with jdk-11 either.
I just hit this error on a fresh install of Ubuntu 18.04 (openjdk 10.0.1 2018-04-17).
export JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'
fixed the bootstrap issue for me (but not the build)
Summary: "mach bootstrap" fails to run for "Android Artifact Mode" when Java 9/10 is installed: CalledProcessError: Command '['sdkmanager', '--package_file=python/mozboot/mozboot/android-packages.txt']' returned non-zero exit status 1 → mach bootstrap and build fails to run when Java 9/10 is installed: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema

Unfortunately, ./mach bootstrap installs default-jdk on Ubuntu, which is JDK10, and hits this assertion. A work-around here is to install openjdk8, and then run sudo update-alternatives --coinfig java and select jdk8.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.