Skip to main content

TestGeneious.initializeAllPlugins() causes java.lang.reflect.InvocationTargetException

Comments

8 comments

  • Jeff Gentry

    Digging in more, a couple of things:

    1. I've managed to get this to work on Windows
    2. 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
  • Matthew Cheung

    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,
    Matthew

    0
  • Jeff Gentry

    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
  • Matthew Cheung

    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
  • Matthew Cheung

    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
  • Jeff Gentry

    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
  • Jeff Gentry

    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
  • Matthew Cheung

    Hmm OK.  Let us know if you end up confirming by installing Geneious on your Mac.

    0

Please sign in to leave a comment.