[geckoview] java.lang.ClassNotFoundException: Didn't find class "org.mozilla.gecko.GeckoJavaSampler"

RESOLVED FIXED in Firefox 52

Status

()

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: nalexander, Assigned: jchen)

Tracking

unspecified
Firefox 52
Points:
---

Firefox Tracking Flags

(firefox52 fixed)

Details

Attachments

(3 attachments)

Sadly Bug 1303806 leaves Gecko without an implementation of the "Java Sampler", and it's enabled unconditionally at compile time.

09-24 16:45:01.972 1325-1346/org.mozilla.geckoview_example I/GeckoThread: RunGecko - args = org.mozilla.geckoview_example -greomni /data/app/org.mozilla.geckoview_example-1/base.apk chrome://browser/content/headless.xul -P default -purgecaches
09-24 16:45:02.009 1325-1346/org.mozilla.geckoview_example W/System.err: java.lang.ClassNotFoundException: Didn't find class "org.mozilla.gecko.GeckoJavaSampler" on path: DexPathList[[zip file "/system/framework/android.test.runner.jar", zip file "/data/app/org.mozilla.geckoview_example-1/base.apk"],nativeLibraryDirectories=[/data/app/org.mozilla.geckoview_example-1/lib/arm, /data/app/org.mozilla.geckoview_example-1/base.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]
09-24 16:45:02.010 1325-1346/org.mozilla.geckoview_example W/System.err:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
09-24 16:45:02.010 1325-1346/org.mozilla.geckoview_example W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
09-24 16:45:02.010 1325-1346/org.mozilla.geckoview_example W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
09-24 16:45:02.010 1325-1346/org.mozilla.geckoview_example W/System.err:     at org.mozilla.gecko.mozglue.GeckoLoader.nativeRun(Native Method)
09-24 16:45:02.011 1325-1346/org.mozilla.geckoview_example W/System.err:     at org.mozilla.gecko.GeckoThread.run(GeckoThread.java:513)
09-24 16:45:02.011 1325-1346/org.mozilla.geckoview_example W/System.err: 	Suppressed: java.lang.ClassNotFoundException: org.mozilla.gecko.GeckoJavaSampler
09-24 16:45:02.011 1325-1346/org.mozilla.geckoview_example W/System.err:     at java.lang.Class.classForName(Native Method)
09-24 16:45:02.011 1325-1346/org.mozilla.geckoview_example W/System.err:     at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
09-24 16:45:02.012 1325-1346/org.mozilla.geckoview_example W/System.err:     at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
09-24 16:45:02.012 1325-1346/org.mozilla.geckoview_example W/System.err:     at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
09-24 16:45:02.012 1325-1346/org.mozilla.geckoview_example W/System.err: 		... 3 more
09-24 16:45:02.012 1325-1346/org.mozilla.geckoview_example W/System.err: 	Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack trace available
I was able to get to the same issue with ANRReporter after copying GeckoJavaSampler into geckoview, so both will need to be addressed.
Assignee: nobody → nchen
Status: NEW → ASSIGNED
Created attachment 8795342 [details] [diff] [review]
1. Move GetClassGlobalRef out of AndroidBridge (v1)

Move GetClassGlobalRef in AndroidBridge to GetClassRef in jni/Utils. The
new function now returns a local reference instead of a global
reference.
Attachment #8795342 - Flags: review?(snorp)
Created attachment 8795343 [details] [diff] [review]
2. Add and use jni::IsFennec() for Fennec-only code (v1)

Add jni::IsFennec() that returns whether we're in a Fennec environment
(defined as the presence of the GeckoApp class). Then, add
jni::IsFennec() checks to places where we use JNI for Fennec-only classes.
Attachment #8795343 - Flags: review?(snorp)
Created attachment 8795344 [details] [diff] [review]
3. Use @JNITarget for Distribution.getDistributionDirectories (v1)

Distribution.getDistributionDirectories is currently annotated with
@WrapForJNI, but because it's used from JS through JNI.jsm, the
@JNITarget annotation is more appropriate.
Attachment #8795344 - Flags: review?(snorp)
Attachment #8795342 - Flags: review?(snorp) → review+
Attachment #8795343 - Flags: review?(snorp) → review+
Attachment #8795344 - Flags: review?(snorp) → review+

Comment 5

2 years ago
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/105160f6218d
1. Move GetClassGlobalRef out of AndroidBridge; r=snorp
https://hg.mozilla.org/integration/mozilla-inbound/rev/41f3ef358765
2. Add and use jni::IsFennec() for Fennec-only code; r=snorp
https://hg.mozilla.org/integration/mozilla-inbound/rev/d700a47ef295
3. Use @JNITarget for Distribution.getDistributionDirectories; r=snorp

Comment 6

2 years ago
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a461830b4d2f
Only enable Java profiling on Android; r=bustage on CLOSED TREE

Comment 7

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/105160f6218d
https://hg.mozilla.org/mozilla-central/rev/41f3ef358765
https://hg.mozilla.org/mozilla-central/rev/d700a47ef295
https://hg.mozilla.org/mozilla-central/rev/a461830b4d2f
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox52: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 52
You need to log in before you can comment on or make changes to this bug.