Issue 128157 - Add support for AdoptOpenJDK JVM's
Summary: Add support for AdoptOpenJDK JVM's
Status: RESOLVED FIXED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: 4.1.6
Hardware: All All
: P2 Normal (vote)
Target Milestone: 4.1.7
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-07-22 14:06 UTC by Ruediger Pluem
Modified: 2019-08-29 19:38 UTC (History)
6 users (show)

See Also:
Issue Type: TASK
Latest Confirmation in: ---
Developer Difficulty: ---
mseidel: 4.1.7_release_blocker+


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ruediger Pluem 2019-07-22 14:06:43 UTC
Can support for AdoptOpenJDK JVM's (https://adoptopenjdk.net/) be added just like LibreOffice did in

https://gerrit.libreoffice.org/plugins/gitiles/core/+/61c4f96d6ae6a80370774e53287edb27cbce8067%5E%21
Comment 1 Ruediger Pluem 2019-07-22 14:18:34 UTC
Similar one seems to #128157
Comment 2 Ruediger Pluem 2019-07-22 14:19:13 UTC
Full URL: https://bz.apache.org/ooo/show_bug.cgi?id=128157
Comment 3 damjan 2019-07-24 04:34:54 UTC
Confirming and setting release blocker.
Comment 4 Mechtilde 2019-07-24 07:15:45 UTC
add me to CC List
Comment 5 oooforum (fr) 2019-07-24 14:40:45 UTC
Add me to Cc too :-)

And set status as TASK
Comment 6 damjan 2019-07-27 13:25:38 UTC
AdoptOpenJDK ships as a tarball:
OpenJDK8U-jre_x64_linux_hotspot_8u222b10.tar.gz

On Ubuntu 16.04 amd64, once that is extracted to a directory, and in AOO under Tools -> Options -> Java -> Add, we choose that directory, it gives a messagebox with "The folder you selected does not contain a Java runtime environment. Please select a different folder."

Attaching gdb at that point and getting a stack trace gives:

#0  0x00007f07a5a0e74d in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f079a65838c in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007f07a1d72b2b in ImplYield (i_bWait=i_bWait@entry=true, i_bAllEvents=i_bAllEvents@entry=false) at /aoo-trunk/main/vcl/source/app/svapp.cxx:476
#5  0x00007f07a1d6fb8c in Application::Yield (i_bAllEvents=i_bAllEvents@entry=false) at /aoo-trunk/main/vcl/source/app/svapp.cxx:510
#6  0x00007f07a1f44396 in Dialog::Execute (this=this@entry=0x7ffef0458e20) at /aoo-trunk/main/vcl/source/window/dialog.cxx:701
#7  0x00007f0775dad4ca in SvxJavaOptionsPage::AddFolder (this=this@entry=0x7f07755c2020, _rFolder=...) at /aoo-trunk/main/cui/source/options/optjava.cxx:581
#8  0x00007f0775dadb9e in SvxJavaOptionsPage::DialogClosedHdl (this=0x7f07755c2020, pEvt=<optimized out>) at /aoo-trunk/main/cui/source/options/optjava.cxx:404
#9  0x00007f07a351f668 in svt::DialogClosedListener::dialogClosed (this=0x7f07755801d0, aEvent=...) at /aoo-trunk/main/svtools/source/misc/dialogclosedlistener.cxx:57
#10 0x00007f07741379b4 in SvtFolderPicker::DialogClosedHdl (this=0x7f078075ae10, pDlg=<optimized out>) at /aoo-trunk/main/fpicker/source/office/OfficeFolderPicker.cxx:150
#11 0x00007f07a1f4453d in Dialog::EndDialog (this=this@entry=0x7f07755a9fb0, nResult=nResult@entry=1) at /aoo-trunk/main/vcl/source/window/dialog.cxx:795
#12 0x00007f0774143d10 in SvtFileDialog::OpenHdl_Impl (pThis=0x7f07755a9fb0, pVoid=0x7f07800d0d40) at /aoo-trunk/main/fpicker/source/office/iodlg.cxx:1327
#13 0x00007f07a1d8fb4b in Control::ImplCallEventListenersAndHandler (this=0x7f07800d0d40, nEvent=1102, rHandler=..., pCaller=0x7f07800d0d40) at /aoo-trunk/main/vcl/source/control/ctrl.cxx:384
#14 0x00007f07a1fa8c91 in Window::EndTracking (this=this@entry=0x7f07800d0d40, nFlags=nFlags@entry=0) at /aoo-trunk/main/vcl/source/window/window2.cxx:764
#15 0x00007f07a1fc98bd in ImplHandleMouseEvent (pWindow=pWindow@entry=0x7f07755a9fb0, nSVEvent=nSVEvent@entry=2, bMouseLeave=bMouseLeave@entry=0 '\000', nX=<optimized out>, nY=<optimized out>, nMsgTime=<optimized out>, nCode=1, nMode=3)
    at /aoo-trunk/main/vcl/source/window/winproc.cxx:807
#16 0x00007f07a1fca81d in ImplHandleSalMouseButtonUp (pWindow=pWindow@entry=0x7f07755a9fb0, pEvent=<optimized out>) at /aoo-trunk/main/vcl/source/window/winproc.cxx:2086
#17 0x00007f07a1fca210 in ImplWindowFrameProc (pWindow=0x7f07755a9fb0, nEvent=<optimized out>, pEvent=0x7ffef0459a58) at /aoo-trunk/main/vcl/source/window/winproc.cxx:2428
#18 0x00007f079b421af8 in GtkSalFrame::signalButton (pEvent=0x12c2580, frame=0x7f07800b25d0) at /aoo-trunk/main/vcl/unx/gtk/window/gtkframe.cxx:2678
#19 0x00007f079a0f5aec in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#20 0x00007f079a92efa5 in g_closure_invoke () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#21 0x00007f079a940fc1 in ?? () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#22 0x00007f079a9497f9 in g_signal_emit_valist () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#23 0x00007f079a94a08f in g_signal_emit () from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007f079a20d93c in ?? () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#25 0x00007f079a0f4284 in gtk_propagate_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#26 0x00007f079a0f463b in gtk_main_do_event () from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#27 0x00007f0799d68c8c in ?? () from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#28 0x00007f079a658197 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007f079a6583f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007f079a65849c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007f079b40a592 in GtkXLib::Yield (this=0x7f07a6e05020, bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at /aoo-trunk/main/vcl/unx/gtk/app/gtkdata.cxx:874
#32 0x00007f07a1d72b2b in ImplYield (i_bWait=i_bWait@entry=true, i_bAllEvents=i_bAllEvents@entry=false) at /aoo-trunk/main/vcl/source/app/svapp.cxx:476
#33 0x00007f07a1d6fb8c in Application::Yield (i_bAllEvents=i_bAllEvents@entry=false) at /aoo-trunk/main/vcl/source/app/svapp.cxx:510
#34 0x00007f07a1f44396 in Dialog::Execute (this=this@entry=0x7f07755be020) at /aoo-trunk/main/vcl/source/window/dialog.cxx:701
#35 0x00007f0775dd17f1 in OfaTreeOptionsDialog::Execute (this=0x7f07755be020) at /aoo-trunk/main/cui/source/options/treeopt.cxx:2631
#36 0x00007f07a3ddd114 in SfxApplication::OfaExec_Impl (this=<optimized out>, rReq=...) at /aoo-trunk/main/sfx2/source/appl/appserv.cxx:838
#37 0x00007f07a3e48ea0 in SfxShell::CallExec (this=0x7f07900cdec0, pFunc=0x7f07a3dd36af <SfxStubSfxApplicationOfaExec_Impl(SfxShell*, SfxRequest&)>, rReq=...) at /aoo-trunk/main/sfx2/inc/sfx2/shell.hxx:200
#38 0x00007f07a3e3ffc0 in SfxDispatcher::Call_Impl (this=0x7f079007cee0, rShell=..., rSlot=..., rReq=..., bRecord=1 '\001') at /aoo-trunk/main/sfx2/source/control/dispatch.cxx:285
#39 0x00007f07a3e423fa in SfxDispatcher::_Execute (this=0x7f079007cee0, rShell=..., rSlot=..., rReq=..., eCallMode=4) at /aoo-trunk/main/sfx2/source/control/dispatch.cxx:1046
#40 0x00007f07a3e435ba in SfxDispatcher::Execute (this=0x7f079007cee0, nSlot=31630, nCall=4, pArgs=0x0, pInternalArgs=0x7ffef045aad0, nModi=0) at /aoo-trunk/main/sfx2/source/control/dispatch.cxx:1310
#41 0x00007f07a3e58476 in SfxDispatchController_Impl::dispatch (this=0x7f0780073f10, aURL=..., aArgs=..., rListener=...) at /aoo-trunk/main/sfx2/source/control/unoctitm.cxx:819
#42 0x00007f07a3e5884a in SfxOfficeDispatch::dispatch (this=0x7f07766de390, aURL=..., aArgs=...) at /aoo-trunk/main/sfx2/source/control/unoctitm.cxx:412
#43 0x00007f0789ec47c3 in framework::MenuBarManager::Select (this=<optimized out>, pMenu=<optimized out>) at /aoo-trunk/main/framework/source/uielement/menubarmanager.cxx:1155
#44 0x00007f07a1f57f1e in Menu::Select (this=0x7f0780751cb0) at /aoo-trunk/main/vcl/source/window/menu.cxx:1149
#45 0x00007f07a1f55a62 in Menu::ImplCallSelect (this=<optimized out>) at /aoo-trunk/main/vcl/source/window/menu.cxx:2981
#46 0x00007f07a1fc8a8b in ImplHandleUserEvent (pSVEvent=pSVEvent@entry=0x7f07766deb10) at /aoo-trunk/main/vcl/source/window/winproc.cxx:1996
#47 0x00007f07a1fca48a in ImplWindowFrameProc (pWindow=0x7f07911b8490, nEvent=<optimized out>, pEvent=0x7f07766deb10) at /aoo-trunk/main/vcl/source/window/winproc.cxx:2568
#48 0x00007f079b12615a in SalDisplay::DispatchInternalEvent (this=0x7f07a6dec020) at /aoo-trunk/main/vcl/unx/generic/app/saldisp.cxx:2231
#49 0x00007f079b40b36f in GtkXLib::userEventFn (data=0x7f07a6e05020) at /aoo-trunk/main/vcl/unx/gtk/app/gtkdata.cxx:817
#50 0x00007f079a65804a in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#51 0x00007f079a6583f0 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#52 0x00007f079a65849c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#53 0x00007f079b40a571 in GtkXLib::Yield (this=0x7f07a6e05020, bWait=<optimized out>, bHandleAllCurrentEvents=<optimized out>) at /aoo-trunk/main/vcl/unx/gtk/app/gtkdata.cxx:869
#54 0x00007f07a1d72b2b in ImplYield (i_bWait=i_bWait@entry=true, i_bAllEvents=i_bAllEvents@entry=false) at /aoo-trunk/main/vcl/source/app/svapp.cxx:476
#55 0x00007f07a1d6fb8c in Application::Yield (i_bAllEvents=i_bAllEvents@entry=false) at /aoo-trunk/main/vcl/source/app/svapp.cxx:510
#56 0x00007f07a1d6fbb1 in Application::Execute () at /aoo-trunk/main/vcl/source/app/svapp.cxx:453
#57 0x00007f07a65a10df in desktop::Desktop::Main (this=0x7ffef045b5d0) at /aoo-trunk/main/desktop/source/app/app.cxx:2232
#58 0x00007f07a1d76b92 in ImplSVMain () at /aoo-trunk/main/vcl/source/app/svmain.cxx:196
#59 0x00007f07a1d76c99 in SVMain () at /aoo-trunk/main/vcl/source/app/svmain.cxx:237
#60 0x00007f07a65d72bb in soffice_main () at /aoo-trunk/main/desktop/source/app/sofficemain.cxx:45
#61 0x0000000000401266 in sal_main () at main.c:31
#62 0x000000000040124b in main (argc=1, argv=0x7ffef045b768) at main.c:30
Comment 7 damjan 2019-07-27 13:28:45 UTC
Frame #7:

#7  0x00007f0775dad4ca in SvxJavaOptionsPage::AddFolder (this=this@entry=0x7f07755c2020, _rFolder=...) at /aoo-trunk/main/cui/source/options/optjava.cxx:581

contains:

578    else if ( JFW_E_NOT_RECOGNIZED == eErr )
579    {
580        ErrorBox aErrBox( this, CUI_RES( RID_SVXERR_JRE_NOT_RECOGNIZED ) );
581        aErrBox.Execute();

---

That eErr is set earlier, in line 532:

532    javaFrameworkError eErr = jfw_getJavaInfoByPath( _rFolder.pData, &pInfo );
Comment 8 damjan 2019-07-27 13:47:37 UTC
Putting a breakpoint and stepping takes us to:

/aoo-trunk/main/jvmfwk/source/framework.cxx:737

Where it gets to calling jfw_plugin_getJavaInfoByPath() on the plugin.

That comes from 
/aoo-trunk/main/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx

It fails here:
352	    rtl::Reference<VendorBase> aVendorInfo = getJREInfoByPath(ouPath);
353	    if (aVendorInfo.is() == sal_False)
354	        return JFW_PLUGIN_E_NO_JRE;

That getJREInfoByPath() function is in:
/aoo-trunk/main/jvmfwk/plugins/sunmajor/pluginlib/util.cxx
Comment 9 damjan 2019-07-27 15:09:28 UTC
Adding lots of logging turned out to be more productive than debugging.

The problem is far down getJREInfoByPath(), it calls getJavaProps() to read the Java properties, and then compares the "java.vendor" properties against known vendors. Since "AdoptOpenJDK" is not a known vendor, it fails to recognize the JRE.

Adding "AdoptOpenJDK" to the XML files under main/jvmfwk/distributions/OpenOfficeorg turned out not to be enough. I've now also patched:

main/jvmfwk/plugins/sunmajor/javaenvsetup/javaldx.cxx
main/jvmfwk/plugins/sunmajor/pluginlib/vendorlist.cxx

to recognize "AdoptOpenJDK", and am rebuilding AOO to test it.
Comment 10 damjan 2019-07-27 15:52:05 UTC
Patch committed in revision 1863875. Resolving FIXED.

Thank you for your bug report!
Comment 11 Matthias Seidel 2019-08-29 19:32:21 UTC
Cherry-picked for AOO 4.1.7 with:
https://gitbox.apache.org/repos/asf?p=openoffice.git;a=commit;h=46fb7e261d0f159f95643b4841a82bfd2c3fb4ab