Hi folks!
I'd like to use the groovy scripting interface of jalview in headless
mode using the -nodisplay command line flag.
However execution of the groovy script is only working in normal gui
mode. When using -nodisplay the following error occurs:
Java version: 1.7.0_79
amd64 Linux 4.0.7-2-ARCH
Jalview Version: 2.8.2 (installAnywhere)
Opening file: /home/user/test.fasta
Jul 14, 2015 10:51:06 AM jalview.util.MessageManager <clinit>
INFORMATION: Getting messages for lang: de_DE
java.awt.HeadlessException
Executing script script.groovy
Hello World.
Exception Whilst trying to execute file
file:/home/user/.local/share/jalview/script.groovy as a groovy script.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at jalview.bin.Jalview.executeGroovyScript(Jalview.java:834)
at jalview.bin.Jalview.main(Jalview.java:455)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.zerog.lax.LAX.launch(Unknown Source)
at com.zerog.lax.LAX.main(Unknown Source)
Caused by: java.lang.NullPointerException
at jalview.gui.Desktop.getAlignframes(Desktop.java:2280)
at jalview.gui.Desktop$getAlignframes.call(Unknown Source)
at
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
at script.run(script.groovy:3)
at groovy.util.GroovyScriptEngine.run(GroovyScriptEngine.java:526)
... 12 more
Here's the sample groovy script taken from the jalview groovy docs:
// do something groovy in jalview
print "Hello World.\n";
def alf = jalview.gui.Desktop.getAlignframes();
for (ala in alf)
{
// ala is an jalview.gui.AlignFrame object
print ala.getTitle()+"\n";
// get the parent jalview.datamodel.Alignment from the alignment viewport
def alignment = ala.viewport.alignment;
// get the first sequence from the jalview.datamodel.Alignment object
def seq = alignment.getSequenceAt(0);
}
As mentioned the script runs fine without the -nodisplay flag.
Is there anyway to make groovy scripting work in headless mode?
Thanks!
Best regards
Leonhard