Bug 124958 - Java Recognition Problems with OpenJDK12
Summary: Java Recognition Problems with OpenJDK12
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.1.5.2 release
Hardware: All macOS (All)
: medium normal
Assignee: Stephan Bergmann
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Java-Runtime-JRE
  Show dependency treegraph
 
Reported: 2019-04-25 14:05 UTC by JE1
Modified: 2019-04-26 11:23 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description JE1 2019-04-25 14:05:39 UTC
When creating a new database, after naming the file (in this instance, New Database Wed 2) and saving, I get this message.

The connection to the data source "New Database Wed 2" could not be established.

The driver class 'org.hsqldb.jdbcDriver' could not be loaded.The additional driver class path is 'vnd.sun.star.expand:$LO_JAVA_DIR/hsqldb.jar vnd.sun.star.expand:$LO_JAVA_DIR/sdbc_hsqldb.jar'.

I have Java 12.0.1 installed and it is showing and selected in Libre Office preferences.
Comment 1 Alex Thurgood 2019-04-25 16:17:31 UTC
@JE1 : 

1) you're not using an external hsqldb.jar, by any chance ? If so, have you added the path to this via the Add Archive dialog under Preferences > Advanced > Java ?


2) does it work properly if you use JDK11 ? 

I don't have a problem with creating embedded hsqldb-ODB files with OpenJDK11 for example in LO6152.
Comment 2 Alex Thurgood 2019-04-25 16:34:55 UTC
Never mind, I can confirm this.

The error message I see :

La classe de pilote 'org.hsqldb.jdbcDriver' n'a pas pu être chargée.Le chemin de classe du pilote supplémentaire est 'vnd.sun.star.expand:$LO_JAVA_DIR/hsqldb.jar vnd.sun.star.expand:$LO_JAVA_DIR/sdbc_hsqldb.jar'.

and expanding the error message :

Code d'erreur: -1

java.lang.NullPointerException


seems to be the same as the one you report.


As OpenJDK11 works for me just fine, it would appear that Oracle has changed something again in its latest release that LO doesn't know how to handle.

@sberg : any ideas ?
Comment 3 Alex Thurgood 2019-04-25 16:43:34 UTC
Tested also with 
Version: 6.2.2.2
Build ID: 2b840030fec2aae0fd2658d8d4f9548af4e3518d
Threads CPU : 8; OS : Mac OS X 10.14.3; UI Render : par défaut; VCL: osx; 
Locale : fr-FR (fr_FR.UTF-8); Langue IHM : fr-FR
Calc: threaded

where I could reproduce the problem.

If I remove OpenJDK12 from my system, LO automatically switches back to OpenJDK11 and all is well again with the embedded hsqldb.
Comment 4 JE1 2019-04-25 17:26:07 UTC
Thanks for the responses.

Removing Java seems like a nightmare for someone not tech-friendly like me.

Is there a way of installing JDK11 and telling the Mac to choose this one instead of JDK12?
Comment 5 Stephan Bergmann 2019-04-26 09:03:47 UTC
(In reply to JE1 from comment #0)
> The connection to the data source "New Database Wed 2" could not be
> established.
> 
> The driver class 'org.hsqldb.jdbcDriver' could not be loaded.The additional
> driver class path is 'vnd.sun.star.expand:$LO_JAVA_DIR/hsqldb.jar
> vnd.sun.star.expand:$LO_JAVA_DIR/sdbc_hsqldb.jar'.
> 
> I have Java 12.0.1 installed and it is showing and selected in Libre Office
> preferences.

That sounds very much like the issue fixed with <https://gerrit.libreoffice.org/plugins/gitiles/core/+/27c6d1dbdb3dcad02a244ab942adb9222a461e44%5E!/> "Avoid calling java.lang.Class.newInstance()".  I have requested a backport to LO 6.2.x now at <https://gerrit.libreoffice.org/#/c/71347/> "Avoid calling java.lang.Class.newInstance()".

(But not sure why Alex flagged this as "regression"?)

(In reply to JE1 from comment #4)
> Is there a way of installing JDK11 and telling the Mac to choose this one
> instead of JDK12?

There should be no issue installing multiple JDKs on macOS.  Then, in LO, go to "LibreOffice - Preferences... - LibreOffice - Advanced" to select a specific Java version to use.
Comment 6 Stephan Bergmann 2019-04-26 09:13:05 UTC
(I just see that the corresponding Java 12 bug I had filed has now been published at <https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8223014> "Calling java.lang.Class.newInstance from JNI Invocation API causes NPE" as a duplicate of <https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8221530> "Field::get and reflective member access not handling caller = null when invoked by JNI code with no java frames on stack", where the latter is stated as fixed in JDK 12.0.2.  So an eventual update of JDK 12 should fix this issue, too.)
Comment 7 JE1 2019-04-26 09:17:26 UTC
Thanks. I'm wary of installing another version of JDK as there is conflicting information about this. Hopefully, the update of Java will help me eventually.
Comment 8 Alex Thurgood 2019-04-26 11:22:23 UTC
(In reply to Stephan Bergmann from comment #5)

> (But not sure why Alex flagged this as "regression"?)

Ah, my bad, I couldn't remember whether this was the same thing as the one you put a fix in for, because the error message seemed different, and because I didn't have an issue with JDK11 being recognized.



> There should be no issue installing multiple JDKs on macOS.  Then, in LO, go
> to "LibreOffice - Preferences... - LibreOffice - Advanced" to select a
> specific Java version to use.

Unfortunately, with current LO6222 or 6152, I could only see OpenJDK12 in the Preferences - Advanced - Java dialog, even if I had both OpenJDK11 and OpenJDK12 installed. Once I removed OpenJDK12 from my system, LO picked up OpenJDK11 automatically on next startup.

Bizarrely enough, Java 1.8 still appears in that Java dialog, in the various flavours I have installed in my Library/Java folder.
Comment 9 Stephan Bergmann 2019-04-26 11:23:58 UTC
(In reply to Stephan Bergmann from comment #5)
> That sounds very much like the issue fixed with
> <https://gerrit.libreoffice.org/plugins/gitiles/core/+/
> 27c6d1dbdb3dcad02a244ab942adb9222a461e44%5E!/> "Avoid calling
> java.lang.Class.newInstance()".  I have requested a backport to LO 6.2.x now
> at <https://gerrit.libreoffice.org/#/c/71347/> "Avoid calling
> java.lang.Class.newInstance()".

...which is included in libreoffice-6-2 towards LO 6.2.4 as <https://gerrit.libreoffice.org/plugins/gitiles/core/+/bfdae9412f6dfbbf961d462debeab392abe447f9%5E%21> "Avoid calling java.lang.Class.newInstance()" now