| Summary: | Warning when using libreoffice.jar from Maven, NativeLibraryLoader expects UnoClassLoader | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Tobias Widmann <widmann> |
| Component: | sdk | Assignee: | Hossein <hossein> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | hossein, michael.stahl, samuel.mehrbrodt, sberg.fun, serval2412 |
| Priority: | medium | ||
| Version: | 7.3.0.3 release | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | target:24.2.0 target:7.6.2 target:7.6.1 target:7.5.7 | ||
| Crash report or crash signature: | Regression By: | ||
|
Description
Tobias Widmann
2022-05-13 11:32:29 UTC
Stephan: just seeing "Java", "Uno", I think you might be interested in this one :-) (In reply to Tobias Widmann from comment #0) > We use libreoffice.jar from Maven to connect to a running (local or remote) > LibreOffice instance. Since version 7.3.0, this results in a > NoClassDefFoundError when calling UnoUrlResolver#resolve. We identified > https://cgit.freedesktop.org/libreoffice/core/commit/ > ?id=97b61ea3297e04e64aab1e1a4ec50202e9f86fff as the source of this problem. > The class com.sun.star.lib.unoloader.UnoClassLoader can't be found in > libreoffice.jar, but instead in unoloader.jar. The libreoffice.jar META-INF/MANIFEST.MF contains > Class-Path: unoloader.jar ../ which should avoid the issue that code from libreoffice.jar can't find classes from unoloader.jar? But maybe that's how Maven works, which I have little idea about. At worst, we could revert the problematic <https://git.libreoffice.org/core/+/97b61ea3297e04e64aab1e1a4ec50202e9f86fff%5E%21> "ridljar: check that UnoClassLoader is used for NativeLibraryLoader" again. Michael, what do you think? (In reply to Stephan Bergmann from comment #2) > The libreoffice.jar META-INF/MANIFEST.MF contains > > > Class-Path: unoloader.jar ../ > > which should avoid the issue that code from libreoffice.jar can't find > classes from unoloader.jar? But maybe that's how Maven works, which I have > little idea about. To make it work with Maven, the dependency on unoloader should be declared in pom.libreoffice.xml, I think. Maybe something along those lines: <dependencyManagement> <dependencies> <dependency> <groupId>org.libreoffice</groupId> <artifactId>unoloader</artifactId> <version>@version@</version> </dependency> </dependencies> </dependencyManagement> Having recently looked into this again, I'd like to add to my original findings: The problem only occurs when using a pipe connection. With a socket, unoloader.jar isn't needed and no warning is printed. This might be a viable workaround for some users. Additionally, I tested versions 7.4.1 and 7.3.6 to verify that the problem still occurs. A similar symptom can be reproduced with FirstUnoContact DevGuide example. It can be found here: LibreOffice Developer's Guide: Chapter 1 - First Steps https://wiki.documentfoundation.org/Documentation/DevGuide/First_Steps#First_Contact Upon running it in official way, I get: $ make FirstUnoContact.run "/usr/bin/java" -Dcom.sun.star.lib.loader.unopath="/opt/libreoffice7.6/program" -jar /home/hossein/libreoffice7.6_sdk/LINUXexample.out/class/FirstStepsExamples/FirstUnoContact.jar warning: com.sun.star.lib.util.NativeLibraryLoader must be loaded by com.sun.star.lib.unoloader.UnoClassLoader for java_uno bridge to work (not a problem if this is using Java remote bridge or unit test) Connected to a running office ... remote ServiceManager is available It is possible to run it manually: You only need to copy FirstUnoContact.java somewhere, and then invoke: (assuming LibreOffice 7.6 on Linux) $ javac -cp /opt/libreoffice7.6/program/classes/unoil.jar FirstUnoContact.java $ java -cp .:/opt/libreoffice7.6/program/classes/unoil.jar FirstUnoContact warning: com.sun.star.lib.util.NativeLibraryLoader must be loaded by com.sun.star.lib.unoloader.UnoClassLoader for java_uno bridge to work (not a problem if this is using Java remote bridge or unit test) Connected to a running office ... remote ServiceManager is available On Windows: > javac -cp "c:\Program Files\LibreOffice\program\classes\unoil.jar" FirstUnoContact.java > java -cp ".;c:\Program Files\LibreOffice\program\classes\unoil.jar" FirstUnoContact warning: com.sun.star.lib.util.NativeLibraryLoader must be loaded by com.sun.star.lib.unoloader.UnoClassLoader for java_uno bridge to work (not a problem if this is using Java remote bridge or unit test) Connected to a running office ... remote ServiceManager is available I tried using com.sun.star.lib.loader.Loader class, but it didn't help. java -Dcom.sun.star.lib.loader.unopath="c:\Program Files\LibreOffice\program" -cp ".;c:\Program Files\LibreOffice\program\classes\unoil.jar;c:\Program Files\LibreOffice\program\classes\unoloader.jar;C:\Program Files\LibreOffice\sdk\classes" com.sun.star.lib.loader.Loader FirstUnoContact warning: com.sun.star.lib.util.NativeLibraryLoader must be loaded by com.sun.star.lib.unoloader.UnoClassLoader for java_uno bridge to work (not a problem if this is using Java remote bridge or unit test) Connected to a running office ... remote ServiceManager is available Hossein committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/345b214c37d1f645dd0e6e084358f8ca81d9ed66 tdf#149069 Revert "ridljar: check UnoClassLoader used for NativeLibraryLoader" It will be available in 24.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. Hossein committed a patch related to this issue. It has been pushed to "libreoffice-7-6": https://git.libreoffice.org/core/commit/b0ef63638b31ae3fcc5e4a6bbf5298040a878ee3 tdf#149069 Revert "ridljar: check UnoClassLoader used for NativeLibraryLoader" It will be available in 7.6.2. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. Hossein committed a patch related to this issue. It has been pushed to "libreoffice-7-6-1": https://git.libreoffice.org/core/commit/e0557220321b09fdbcaaeaffbdf31e072e6511c4 tdf#149069 Revert "ridljar: check UnoClassLoader used for NativeLibraryLoader" It will be available in 7.6.1. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. Hossein committed a patch related to this issue. It has been pushed to "libreoffice-7-5": https://git.libreoffice.org/core/commit/db0ee77abb37c1c649cc14c1a8e54ed5357eef09 tdf#149069 Revert "ridljar: check UnoClassLoader used for NativeLibraryLoader" It will be available in 7.5.7. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback. (In reply to Commit Notification from comment #9) > Hossein committed a patch related to this issue. > It has been pushed to "libreoffice-7-5": > > https://git.libreoffice.org/uno online https://uno-online.io > db0ee77abb37c1c649cc14c1a8e54ed5357eef09 > > tdf#149069 Revert "ridljar: check UnoClassLoader used for > NativeLibraryLoader" > > It will be available in 7.5.7. > > The patch should be included in the daily builds available at > https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More > information about daily builds can be found at: > https://wiki.documentfoundation.org/Testing_Daily_Builds > > Affected users are encouraged to test the fix and report feedback. Hello, is there a specific area of testing you'd like feedback on? |