TestGeneious.initializeAllPlugins() causes java.lang.reflect.InvocationTargetException
I'm picking up an old plugin project. It has a handful of unit tests. The tests all invoke "TestGeneious.initializeAllPlugins()". These fail with a java.lang.reflect.InvocationTargetException (stack trace included below).
The root of it appears to be "Caused by: java.lang.NoClassDefFoundError: com/biomatters/geneious/laf/g", but it's unclear to me what that is.
I then cloned the "geneious-mira" plugin on the biomatters Github, and am getting an almost identical stack trace, with slight differences due to how things are invoked. But the pattern is the same where once `TestGeneious.initializePlugins()` is invoked it winds up in the same place.
I believe I have all of the GeneiousFiles/lib dir, GeneiousFiles/resources, and iSeek.jar in my class path. Am I doing something wrong here? This is on macOS Sonoma & a Ubuntu linux container running on the same Mac. Trying to see if I get the same issue on Windows, but TBD
-
Digging in more, a couple of things:
- I've managed to get this to work on Windows
- I think I've narrowed it down to the following issue after fiddling with it a bit: `
Caused by: java.lang.IllegalStateException: Could not find resource: libMacFontBundler.dylib for class: com.biomatters.geneious.laf.b$b`.
0 -
Hi Jeff,
For the geneious-mira project it looks like the problem is that the native_libs directory is missing from the classpath when running tests (it is there when using runGeneious).
Modifying line 58 in geneiousplugin.gradle to the following seems to work (addition in bold).
environment "DYLD_LIBRARY_PATH", "/Library/Application Support/Geneious/Frameworks:native_libs/macos"
Try that for your plugin. If that doesn't work can you:
- Let me know how you're running the test e.g. Gradle vs IDE vs something else
- Attach the full console output
Hope that helps.
Cheers,
Matthew0 -
Hmm, thanks, this moved things in the right direction at least. For context, I'm using Gradle. I have the `GeneiousFiles` downloaded in `build`, in a similar manner to the Mira plugin. What I currently have in gradle, also cribbed heavily from the Mira plugin is:
tasks.test {
dependsOn(extractGeneiousRuntimeFiles)
workingDir file("$buildDir/$geneiousFilesName")
minHeapSize '256M'
maxHeapSize '2048M'
jvmArgs '-ea',
'-XX:MaxNewSize=40M',
'-XX:ReservedCodeCacheSize=128m',
'-Xss512K',
'-XX:+UseConcMarkSweepGC',
'-Djava.util.logging.config.file=no_logging.properties',
'--add-opens=java.base/jdk.internal.reflect=ALL-UNNAMED'
environment "DYLD_LIBRARY_PATH", "native_libs/macos:resources/com/biomatters/geneious/laf"
useJUnitPlatform()
}Now the stack trace is failing related to fonts. Which I do see in `resources/com/biomatters/geneious/fonts`
Caused by: java.lang.AssertionError: Failed to initialize bundled font. expected=Noto Sans, got=Dialog at com.biomatters.geneious.laf.b$a.a(CompositeFontFactory.java:117) at com.biomatters.geneious.laf.g.a(LookAndFeelManager.java:105) at com.biomatters.geneious.laf.g.d(LookAndFeelManager.java:95) at com.biomatters.geneious.laf.GeneiousFlatLafTheme.setGeneiousCustomProperties(GeneiousFlatLafTheme.java:172) at com.biomatters.geneious.laf.GeneiousFlatLafTheme.setup(GeneiousFlatLafTheme.java:57) at com.biomatters.geneious.laf.g.f(LookAndFeelManager.java:54) at com.biomatters.geneious.publicapi.utilities.ThreadUtilities.lambda$invokeAndWait$0(ThreadUtilities.java:107) at org.virion.jam.util.Utils$1.run(Utils.java:130) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:303) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
0 -
Hard to know why the font isn't being loaded there. Make sure that one of the TestGeneious.initialize() methods being called before anything else in your test. That can sometimes be the problem.
If that isn't the problem, could you share the code with us at support@geneious.com and I can take a look to see what the problem is.
0 -
Not sure if the problem was resolved in the end, but one of my team mentioned that it can also be caused by a bug in Java that has been fixed in Java 11.0.22 at least.
0 -
Hi - to be honest I just shifted my workflow to use a Windows Remote Desktop where I have Geneious installed instead. However this is interesting, and my version of Java is 11.0.17, so I'll give this a try.
0 -
It did not change the issue, using 11.0.23+9. I will say that I've been suspicious it's the lack of having Geneious installed at all on this machine.
0 -
Hmm OK. Let us know if you end up confirming by installing Geneious on your Mac.
0 -
Yeah, unfortunately I don't have access to the license server being used via my Mac, thus the lack of the install. Unless you think the only issue is the files need to be present. For instance, when I run tests on the windows remote desktop I get a popup that says it can't connect to the license server - so I was assuming it needed at least something "real". That said, lack of connectivity doesn't affect the tests so perhaps it doesn't matter.
0
Please sign in to leave a comment.
Comments
9 comments