Discussion:
Bug#895440: jabref: [~Unable to connect to libreoffice
Add Reply
D Haley
2018-04-11 14:20:01 UTC
Reply
Permalink
Package: jabref
Version: 3.8.1+ds-3
Severity: normal

Dear Maintainer,

The Libreoffice "connect" feature does not appear to work in this version
of jabref by default.

The "manual connect" feature [1][2] fails as it is looking for several
.jar files:

unoil.jar
jurt.jar
juh.jar
ridl.jar

These files are located in some of these folders (but not all):
/usr/share/java/
/usr/lib/libreoffice/program/classes/
/usr/share/libreoffice/program/classes/

which are not in the default paths listed by the program.

Furthermore, as jabref insists on appending "program/classes/" to
any path that you specify, you can only access them by supplying
"/usr/lib/libreoffice/" as the path. Using /usr/share/java/ or
/usr/share/libreoffice/ does not work, as not all jars are in these
directories (for /usr/share/libreoffice/ OR under the apprpriate sub-path
(program/classes, as the case for /usr/share/java/).

Possible solutions:
1) The default path in the automatic or manual connect could pointed to /usr/lib/libreoffice/
2) Upstream could allow specifying multiple search paths
3) Upstream could hard-code in multiple search locations, such
as /usr/share/java/ and drop the hard-coded requirement for the
"program/classes/" subfolder, and search these optionally
4) Libreoffice could be more consistent in where .jar files are symlinked/installed. The "ure" package does not use /usr/lib/ for .jar installation.

Thanks!

[1] https://help.jabref.org/en/OpenOfficeIntegration
[2] https://www.onetransistor.eu/2015/04/libreoffice-bibliography-jabref.html

-- System Information:
Debian Release: 9.4
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-6-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.utf8, LC_CTYPE=en_GB.utf8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages jabref depends on:
ii default-jre [java8-runtime] 2:1.8-58
ii java-wrappers 0.1.28
ii libandroid-json-java 7.0.0+r33-1
ii libantlr3-runtime-java 3.5.2-6
ii libantlr4-runtime-java 4.5.3-1
ii libbcprov-java 1.56-1+deb9u1
ii libcommons-cli-java 1.3.1-3
ii libcommons-lang3-java 3.5-1
ii libcommons-logging-java 1.2-1
ii libglazedlists-java 1.9.1-2
ii libguava-java 19.0-1
ii libhttpasyncclient-java 4.1.2-1
ii libhttpclient-java 4.5.2-2
ii libhttpmime-java 4.5.2-2
ii libjava-string-similarity-java 0.19-1
ii libjempbox-java 1:1.8.12-1
ii libjgoodies-common-java 1.8.1-2
ii libjgoodies-forms-java 1.9.0-3
ii libjgoodies-looks-java 2.7.0-2
ii libjhlabs-filters-java 2.0.235-3
ii libjsoup-java 1.10.2-1
ii liblog4j2-java 2.7-2
ii libmicroba-java 1:0.4.4.3-5
ii libpdfbox-java 1:1.8.12-1
ii libreoffice-java-common 1:6.0.2-1~bpo9+1
ii libspin-java 1.5+dfsg-8
ii libswing-layout-java 1.0.4-4
ii libswingx-java 1:1.6.2-2
ii libunirest-java-java 1.4.8-2
ii openjdk-8-jre [java8-runtime] 8u121-b13-4

Versions of packages jabref recommends:
ii libmysql-java 5.1.42-1
ii libpostgresql-jdbc-java 9.4.1212-1
ii libreoffice-writer 1:6.0.2-1~bpo9+1
ii xdg-utils 1.1.1-1

Versions of packages jabref suggests:
ii evince [postscript-viewer] 3.22.1-3+deb9u1
ii ghostscript [postscript-viewer] 9.20~dfsg-3.2+deb9u1
ii mupdf [pdf-viewer] 1.9a+ds1-4+deb9u2
ii okular [postscript-viewer] 4:16.08.2-1+b1

-- no debconf information
gregor herrmann
2018-04-23 13:20:01 UTC
Reply
Permalink
Control: tag -1 + unreproducible
Post by D Haley
Package: jabref
Version: 3.8.1+ds-3
Severity: normal
The Libreoffice "connect" feature does not appear to work in this version
of jabref by default.
Thanks for your bug report, and sorry for the late reply.
I could not reproduce it on unstable, and it took me a bit of time to
find an opportunity to test it on stable.

And unfortunately I also can't reproduce it on stable. When I start
LO writer and then JabRef and then click on the automatic connect
button it succeeds, and I can then e.g. press "Cite" to insert a
citation of the current book.
Post by D Haley
Furthermore, as jabref insists on appending "program/classes/" to
any path that you specify, you can only access them by supplying
"/usr/lib/libreoffice/" as the path. Using /usr/share/java/ or
/usr/share/libreoffice/ does not work, as not all jars are in these
directories (for /usr/share/libreoffice/ OR under the apprpriate sub-path
(program/classes, as the case for /usr/share/java/).
When I click an "manual connect", I see:
Path to OO/LO executable: /usr/lib/libreoffice/program/soffice
Path to OO/LO library dir: /usr/lib/libreoffice/program/classes
[..]
Post by D Haley
4) Libreoffice could be more consistent in where .jar files are symlinked/installed. The "ure" package does not use /usr/lib/ for .jar installation.
The only thing I notice is that
Post by D Haley
ii libreoffice-java-common 1:6.0.2-1~bpo9+1
ii libreoffice-writer 1:6.0.2-1~bpo9+1
you are using LO from backports; maybe the library problem you
mention only exists there but not in plain stable or in unstable?

In any case, if a LO jar is not in the right directory (or a symlink)
this would be more a problem in some LO component (or ure) than in
jabref.


Cheers,
gregor
--
.''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org
: :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06
`. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
`- BOFH excuse #3: electromagnetic radiation from satellite debris
Gary Porter
2019-07-24 16:10:01 UTC
Reply
Permalink
Experiencing the same problem in Buster with a vanilla installation, but probably with a different cause.

Using jabref 3.8.2+ds-12, jabref is unable to connect to libreoffice automatically or manually.

I see this output from jabref when I attempt to connect:
java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at net.sf.jabref.gui.openoffice.OpenOfficePanel.addURL(OpenOfficePanel.java:484) ~[JabRef-3.8.2.jar:?]
at net.sf.jabref.gui.openoffice.OpenOfficePanel.connect(OpenOfficePanel.java:419) ~[JabRef-3.8.2.jar:?]
at net.sf.jabref.gui.openoffice.OpenOfficePanel.lambda$initPanel$0(OpenOfficePanel.java:141) ~[JabRef-3.8.2.jar:?]
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) ~[?:?]
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) ~[?:?]
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) ~[?:?]
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) ~[?:?]
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) ~[?:?]
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297) ~[?:?]
at java.awt.Component.processMouseEvent(Component.java:6632) ~[?:?]
at javax.swing.JComponent.processMouseEvent(JComponent.java:3342) ~[?:?]
at java.awt.Component.processEvent(Component.java:6397) ~[?:?]
at java.awt.Container.processEvent(Container.java:2263) ~[?:?]
at java.awt.Component.dispatchEventImpl(Component.java:5008) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2321) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4840) ~[?:?]
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) ~[?:?]
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) ~[?:?]
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2307) ~[?:?]
at java.awt.Window.dispatchEventImpl(Window.java:2772) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4840) ~[?:?]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) ~[?:?]
at java.awt.EventQueue$5.run(EventQueue.java:745) ~[?:?]
at java.awt.EventQueue$5.run(EventQueue.java:743) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:742) ~[?:?]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?]
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?]

JabRef was able to connect to LibreOffice fine for me in Stretch.

Thanks,
Gary
p.s. I inadvertently sent the last email as HTML (sorry), so I am resending it as plain text.
gregor herrmann
2019-08-07 00:20:02 UTC
Reply
Permalink
Control: tag -1 + confirmed
Post by Gary Porter
Experiencing the same problem in Buster with a vanilla installation, but probably with a different cause.
Using jabref 3.8.2+ds-12, jabref is unable to connect to libreoffice automatically or manually.
I can reproduce this issue (on unstable). If I try to connect
manually (with the default values for the LO executable and libs), I
get an error message saying:

"File not found: /usr/lib/libreoffice/program/classes/program/classes/unoil.jar"

If I try to connect manually again but change the lib path from
/usr/lib/libreoffice/programm/classes to /usr/lib/libreoffice/ I
don't get an error window from JabRef but it still fails with a java
backtrace like yours:

02:11:07.355 [AWT-EventQueue-0] ERROR net.sf.jabref.FallbackExceptionHandler - Uncaught exception Occurred in Thread[AWT-EventQueue-0,6,main]
java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at net.sf.jabref.gui.openoffice.OpenOfficePanel.addURL(OpenOfficePanel.java:484) ~[JabRef-3.8.2.jar:?]
at net.sf.jabref.gui.openoffice.OpenOfficePanel.connect(OpenOfficePanel.java:419) ~[JabRef-3.8.2.jar:?]
at net.sf.jabref.gui.openoffice.OpenOfficePanel.lambda$initPanel$1(OpenOfficePanel.java:142) ~[JabRef-3.8.2.jar:?]
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967) ~[?:?]
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308) ~[?:?]
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405) ~[?:?]
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) ~[?:?]
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:279) ~[?:?]
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297) ~[?:?]
at java.awt.Component.processMouseEvent(Component.java:6632) ~[?:?]
at javax.swing.JComponent.processMouseEvent(JComponent.java:3342) ~[?:?]
at java.awt.Component.processEvent(Component.java:6397) ~[?:?]
at java.awt.Container.processEvent(Container.java:2263) ~[?:?]
at java.awt.Component.dispatchEventImpl(Component.java:5008) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2321) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4840) ~[?:?]
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4918) ~[?:?]
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4547) ~[?:?]
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4488) ~[?:?]
at java.awt.Container.dispatchEventImpl(Container.java:2307) ~[?:?]
at java.awt.Window.dispatchEventImpl(Window.java:2772) ~[?:?]
at java.awt.Component.dispatchEvent(Component.java:4840) ~[?:?]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:772) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:721) ~[?:?]
at java.awt.EventQueue$4.run(EventQueue.java:715) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:95) ~[?:?]
at java.awt.EventQueue$5.run(EventQueue.java:745) ~[?:?]
at java.awt.EventQueue$5.run(EventQueue.java:743) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) ~[?:?]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:742) ~[?:?]
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?]
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?]
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?]
at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?]


So yeah. there is an issue; and this has worked the last time I tried
it 
 Maybe some change in OpenJDK? -- This needs further
investigation.


Cheers,
gregor
--
.''`. https://info.comodo.priv.at -- Debian Developer https://www.debian.org
: :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D 85FA BB3A 6801 8649 AA06
`. `' Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
`- NP: Page&Plant: Blue Train
tony mancill
2019-08-10 16:00:01 UTC
Reply
Permalink
Post by gregor herrmann
Control: tag -1 + confirmed
Post by Gary Porter
Experiencing the same problem in Buster with a vanilla installation, but probably with a different cause.
Using jabref 3.8.2+ds-12, jabref is unable to connect to libreoffice automatically or manually.
I can reproduce this issue (on unstable). If I try to connect
manually (with the default values for the LO executable and libs), I
"File not found: /usr/lib/libreoffice/program/classes/program/classes/unoil.jar"
If I try to connect manually again but change the lib path from
/usr/lib/libreoffice/programm/classes to /usr/lib/libreoffice/ I
don't get an error window from JabRef but it still fails with a java
02:11:07.355 [AWT-EventQueue-0] ERROR net.sf.jabref.FallbackExceptionHandler - Uncaught exception Occurred in Thread[AWT-EventQueue-0,6,main]
java.lang.ClassCastException: class jdk.internal.loader.ClassLoaders$AppClassLoader cannot be cast to class java.net.URLClassLoader (jdk.internal.loader.ClassLoaders$AppClassLoader and java.net.URLClassLoader are in module java.base of loader 'bootstrap')
at net.sf.jabref.gui.openoffice.OpenOfficePanel.addURL(OpenOfficePanel.java:484) ~[JabRef-3.8.2.jar:?]
<snip>
So yeah. there is an issue; and this has worked the last time I tried
it 
 Maybe some change in OpenJDK? -- This needs further
investigation.
Thank you both for reporting and confirming the issue. I will take a
look this weekend.

Cheers,
tony
tony mancill
2019-08-12 04:20:01 UTC
Reply
Permalink
Post by tony mancill
Post by gregor herrmann
So yeah. there is an issue; and this has worked the last time I tried
it 
 Maybe some change in OpenJDK? -- This needs further
investigation.
Thank you both for reporting and confirming the issue. I will take a
look this weekend.
This is definitely due to a change in how classloaders work in Java
after Java 8. You can refer to this thread for more information:

https://community.oracle.com/thread/4011800

I spent a little time working on a patch for JabRef to use the

Class.forName("foo", true, new URLClassLoader(URL[] bar));

pattern if the ClassLoader returned from the system isn't an instance of
URLClassLoader, which addresses the first stacktrace reported, but there
are (at least) two more that need to be addressed in the JabRef sources.

So for the time-being, I recommend installing openjdk-8-jre and starting
jabref like so:

JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 jabref

Running on Java 8, I was able to manually connect to LibreOffice using
the parameters:

Path to OpenOffice/LibreOffice executable: /usr/bin/libreoffice
Path to OpenOffice/LibreOffice library dir: /usr/lib/libreoffice

I might continue to work on a patch for this, but even the latest
upstream version 4.3.1 doesn't run on Java 11 yet, so I'm reluctant to
invest too much in a hack that needs to be reworked upstream.

Regards,
tony

Loading...