Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entry preview: Error while generating citation style #5622

Open
KarlMagnusLarsson opened this issue Nov 16, 2019 · 14 comments
Open

Entry preview: Error while generating citation style #5622

KarlMagnusLarsson opened this issue Nov 16, 2019 · 14 comments

Comments

@KarlMagnusLarsson
Copy link

@KarlMagnusLarsson KarlMagnusLarsson commented Nov 16, 2019

JabRef 5.0.0-dev--2019-11-16----3fbeef03d
Mac OS X 10.13.6 x86_64
Java 13.0.1

Steps to reproduce:

  1. Select any entry from an open bibliography.
  2. Double left click on entry to show the different fields in the lower portion of the window.
  3. The right hand side shows "Error while generating citation style", instead of a preview of the citation.

Jabref-5.0.0 has been in this state for a couple of development snapshots.

I have configured APA style, but I get the same "Error while generating citation style" with other styles. I get the same error for all entries in the bibliography.

@KarlMagnusLarsson KarlMagnusLarsson changed the title Entry preview: Error wile generating preview style Entry preview: Error while generating citation style Nov 16, 2019
@tobiasdiez tobiasdiez added this to Needs triage in Bugs via automation Nov 17, 2019
@tobiasdiez tobiasdiez added this to the v5.0 milestone Nov 17, 2019
@Siedlerchr

This comment has been minimized.

Copy link
Contributor

@Siedlerchr Siedlerchr commented Nov 18, 2019

Can confirm this. Think it is a follow up issue from #5585
I debugged it down and it triggers the ArgumentException which is ignored.

Actual exception and stack trace.
I looked into my JabRef folder and it seems like there is some problem with the csl-locale git submodule. Mine is empty.

org.graalvm.polyglot.PolyglotException: Unable to load locale en-US
 [org.jabref/org.jabref.logic.citationstyle.JabRefLocaleProvider.lambda$0(JabRefLocaleProvider.java:29), java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1138), org.jabref/org.jabref.logic.citationstyle.JabRefLocaleProvider.retrieveLocale(JabRefLocaleProvider.java:25), <js>.Sys.retrieveLocale(Unnamed:19), <js>.localeConfigure(Unnamed:9044), <js>.CSL.Engine(Unnamed:3710), <js>.makeCsl(Unnamed:54), org.graalvm.sdk/org.graalvm.polyglot.Value.execute(Value.java:366), citeproc.java@2.0.0/de.undercouch.citeproc.script.GraalScriptRunner.callMethod(GraalScriptRunner.java:49), citeproc.java@2.0.0/de.undercouch.citeproc.CSL.<init>(CSL.java:283), citeproc.java@2.0.0/de.undercouch.citeproc.CSL.<init>(CSL.java:252), citeproc.java@2.0.0/de.undercouch.citeproc.CSL.<init>(CSL.java:231), org.jabref/org.jabref.logic.citationstyle.CSLAdapter.initialize(CSLAdapter.java:69), org.jabref/org.jabref.logic.citationstyle.CSLAdapter.makeBibliography(CSLAdapter.java:53), org.jabref/org.jabref.logic.citationstyle.CitationStyleGenerator.generateCitations(CitationStyleGenerator.java:56), org.jabref/org.jabref.logic.citationstyle.CitationStyleGenerator.generateCitation(CitationStyleGenerator.java:47), org.jabref/org.jabref.logic.citationstyle.CitationStylePreviewLayout.generatePreview(CitationStylePreviewLayout.java:15), org.jabref/org.jabref.gui.preview.PreviewViewer.lambda$4(PreviewViewer.java:184), org.jabref/org.jabref.gui.util.BackgroundTask$1.call(BackgroundTask.java:47), org.jabref/org.jabref.gui.util.DefaultTaskExecutor$1.call(DefaultTaskExecutor.java:130), javafx.graphics/javafx.concurrent.Task$TaskCallable.call(Task.java:1425), java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264), java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515), java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264), java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128), java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628), java.base/java.lang.Thread.run(Thread.java:830)]

@Siedlerchr

This comment has been minimized.

Copy link
Contributor

@Siedlerchr Siedlerchr commented Nov 18, 2019

After I deleted and readded the csl-locale submodule it works again for me when running from eclipse.
So I guess there might be something wrong with the modules in the installer

@tobiasdiez

This comment has been minimized.

Copy link
Member

@tobiasdiez tobiasdiez commented Nov 18, 2019

@koppor what do you think about replacing the git submodules by git subtrees? Then we also don't run into these problems that some people are pushing changes to the submodule commit hash as part of PRs.

@koppor

This comment has been minimized.

Copy link
Member

@koppor koppor commented Nov 18, 2019

Reading https://codewinsarguments.co/2016/05/01/git-submodules-vs-git-subtrees/ -- +1 for subtrees.

Is the external repository third party code that you are unlikely to push anything back to? Then use a subtree. This gives the advantage of not having to give people permissions to an extra repo when you are giving them access to the code base, and also reduces the chance that someone will forget to run a git submodule update.

Should we go for the "squashed" history? --> https://stackoverflow.com/a/51774939/873282 --> "Alt Squashed history"

@tobiasdiez

This comment has been minimized.

Copy link
Member

@tobiasdiez tobiasdiez commented Nov 19, 2019

Yes, squashed history sounds good (I don't think we care about the detailed changes to the style files).

@koppor

This comment has been minimized.

Copy link
Member

@koppor koppor commented Nov 20, 2019

PR to switch to git subtrees created: #5647

@Siedlerchr

This comment has been minimized.

Copy link
Contributor

@Siedlerchr Siedlerchr commented Dec 3, 2019

Git subtrees fixed the thing with the missing resources. Now I get the following error in the portable version of JabRef with loading the csl:


ERROR PreviewViewer Error while generating citation style
 java.lang.Exception: java.lang.NoClassDefFoundError: org/graalvm/polyglot/PolyglotException
        at org.jabref/org.jabref.gui.util.DefaultTaskExecutor.convertToException(Unknown Source)
        at org.jabref/org.jabref.gui.util.DefaultTaskExecutor.lambda$getJavaFXTask$3(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
        at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source)
        at org.jabref.merged.module/javafx.concurrent.EventHelper.fireEvent(Unknown Source)
        at org.jabref.merged.module/javafx.concurrent.Task.fireEvent(Unknown Source)
        at org.jabref.merged.module/javafx.concurrent.Task.setState(Unknown Source)
        at org.jabref.merged.module/javafx.concurrent.Task$TaskCallable.lambda$call$2(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Unknown Source)
        at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
        at org.jabref.merged.module/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
        at org.jabref.merged.module/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
        at org.jabref.merged.module/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/graalvm/polyglot/PolyglotException
        at org.jabref.merged.module/de.undercouch.citeproc.script.ScriptRunnerFactory.createGraalRunner(Unknown Source)
        at org.jabref.merged.module/de.undercouch.citeproc.script.ScriptRunnerFactory.createRunner(Unknown Source)
        at org.jabref.merged.module/de.undercouch.citeproc.CSL.getRunner(Unknown Source)
        at org.jabref.merged.module/de.undercouch.citeproc.CSL.<init>(Unknown Source)
        at org.jabref.merged.module/de.undercouch.citeproc.CSL.<init>(Unknown Source)
        at org.jabref.merged.module/de.undercouch.citeproc.CSL.<init>(Unknown Source)
        at org.jabref/org.jabref.logic.citationstyle.CSLAdapter.initialize(Unknown Source)
        at org.jabref/org.jabref.logic.citationstyle.CSLAdapter.makeBibliography(Unknown Source)
        at org.jabref/org.jabref.logic.citationstyle.CitationStyleGenerator.generateCitations(Unknown Source)
        at org.jabref/org.jabref.logic.citationstyle.CitationStyleGenerator.generateCitation(Unknown Source)
        at org.jabref/org.jabref.logic.citationstyle.CitationStylePreviewLayout.generatePreview(Unknown Source)
        at org.jabref/org.jabref.gui.preview.PreviewViewer.lambda$update$3(Unknown Source)
        at org.jabref/org.jabref.gui.util.BackgroundTask$1.call(Unknown Source)
        at org.jabref/org.jabref.gui.util.DefaultTaskExecutor$1.call(Unknown Source)
        at org.jabref.merged.module/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        ... 1 more
Caused by: java.lang.ClassNotFoundException: org.graalvm.polyglot.PolyglotException
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        ... 21 more
@tobiasdiez

This comment has been minimized.

Copy link
Member

@tobiasdiez tobiasdiez commented Dec 6, 2019

Everything works if you run from code (Intellj). However, when using the installer I still have an empty list of citation styles in the preference dialog.

@Siedlerchr

This comment has been minimized.

Copy link
Contributor

@Siedlerchr Siedlerchr commented Dec 6, 2019

When you run from installer or portable the exception above is logged on the console window behind JabRef.
From my point of view this looks like a modularity issue. Maybe some module access stuff

@tobiasdiez

This comment has been minimized.

Copy link
Member

@tobiasdiez tobiasdiez commented Dec 7, 2019

@michel-kraemer can you please have a look at this, as this seems to be a problem with citeproc 2.0. Thanks!

@koppor

This comment has been minimized.

Copy link
Member

@koppor koppor commented Jan 8, 2020

This could be a solution? #5246 (comment)

@koppor koppor self-assigned this Jan 8, 2020
@michel-kraemer

This comment has been minimized.

Copy link
Contributor

@michel-kraemer michel-kraemer commented Jan 9, 2020

It seems to me org.graalvm.polyglot.PolyglotException is missing in the portable version. It is located inside graal-sdk-19.2.1.jar. Can you please check if this file is there? Or, if you're creating a fat jar, if the class file org/graalvm/polyglot/PolyglotException.class is there?

@koppor I don't see how this could be a solution. By the way, there is a method called CSL.getSupportedStyles() that returns a list of all styles in the classpath. It should work regardless of whether the application is run from the IDE or from a packaged jar file.

@michel-kraemer

This comment has been minimized.

Copy link
Contributor

@michel-kraemer michel-kraemer commented Jan 9, 2020

Oh, by the way, I'm currently working on a pure Java implementation of citeproc-java. It does not support all CSL features yet but it works OK most of the time already. If you're interested, I can publish a snapshot of citeproc-java. This should solve all problems related to Graal JavaScript or Nashorn, and it should improve performance by a magnitude.

@Siedlerchr

This comment has been minimized.

Copy link
Contributor

@Siedlerchr Siedlerchr commented Jan 9, 2020

@michel-kraemer
The PolyglotException class is there: I checked again with the latest master (windows portable)
https://builds.jabref.org/master/
JabRef-5.0-portable_windows\JabRef\app\mods\graal-sdk-19.2.1.jar\org\graalvm\polyglot\

The only thing which comes to my minds is, do you have an (Automatic) Module name/manifest for citeproc-java? Maybe it's some modularity/classpath issue with jlink/jpackage.

I think it's worth a try to test the snapshot of the pure java implementation

@koppor koppor removed their assignment Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Bugs
  
Needs triage
5 participants
You can’t perform that action at this time.