[Archive] batch mode -p, why X11?

Message by Fredrik Johansson:
Hello again. I think this is an old question, but I can’t find the answer in the forums. I’m trying to run SPIS on computer cluster and submitting the job to be run whenever possible. I think I remember the batch mode has changed slightly since Spis 4.3. Is it now necessary to have X11 installed? even though it is not used with the -p flag?
I guess this is outside the scope of SPIS in general, but do you have any suggestions how to circumvent this? I’ll reply to myself if I find a nice workaround for future reference


I get the following error: ERROR ! org-keridwen-core-ui-dockingframes.2.0.8 ! ! ERROR ! : ! org.keridwen.core.ui.dockingframes.internal.DefaultMenuService-0 ! createInstance -> Cannot invoke the constructor method - the constructor throws an exception : Could not initialize class sun.awt.X11GraphicsEnvironment java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment

Message by ruard:
Dear Fredrik,
Normally when you launch spis with the -p option, no X11 must be installed.
You can test to launch the SphereLowResolution.spis5 spis 5 project distributed with spis 5.1.8 in the data directory. It should work without X11.
Can you give us your entire log file to know the context of the error please?
Regards,
Benjamin Jeanty Ruard

Message by Fredrik Johansson:
Hello Benjamin!
Thanks for the reply.
I did run the SphereLowResolution.spis5 and it initiated and ran without error!
I then ran my own simulation and it crashed immediately.
The error log in it’s entirety below the line. The command preceding it is
sh SpisGeoNo3D.sh -p $SCRATCH/RC-PAU_100_1_20Nov15-1.spis5


2015-11-23 14:54:17,056 ERROR ! org-keridwen-core-ui-dockingframes.2.0.8 ! ! ERROR ! : ! org.keridwen.core.ui.dockingframes.internal.DefaultMenuService-0 ! createInstance -> Cannot invoke the constructor method - the constructor throws an exception : Could not initialize class sun.awt.X11GraphicsEnvironment java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment at java.lang.Class.forName0(Native Method) ~! na:1.6.0\_22 ! at java.lang.Class.forName(Unknown Source) ~! na:1.6.0\_22 ! at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Unknown Source) ~! na:1.6.0\_22 ! at sun.awt.X11.XToolkit.(Unknown Source) ~! na:1.6.0\_22 ! at java.lang.Class.forName0(Native Method) ~! na:1.6.0\_22 ! at java.lang.Class.forName(Unknown Source) ~! na:1.6.0\_22 ! at java.awt.Toolkit$2.run(Unknown Source) ~! na:1.6.0\_22 ! at java.security.AccessController.doPrivileged(Native Method) ~! na:1.6.0\_22 ! at java.awt.Toolkit.getDefaultToolkit(Unknown Source) ~! na:1.6.0\_22 ! at sun.swing.SwingUtilities2$AATextInfo.getAATextInfo(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.plaf.metal.MetalLookAndFeel.initComponentDefaults(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.plaf.basic.BasicLookAndFeel.getDefaults(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.UIManager.setLookAndFeel(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.UIManager.setLookAndFeel(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.UIManager.initializeDefaultLAF(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.UIManager.initialize(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.UIManager.maybeInitialize(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.UIManager.getUI(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.JMenuBar.updateUI(Unknown Source) ~! na:1.6.0\_22 ! at javax.swing.JMenuBar.(Unknown Source) ~! na:1.6.0\_22 ! at org.keridwen.core.ui.dockingframes.internal.DefaultMenuService.(DefaultMenuService.java:46) ~! na:na ! at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~! na:1.6.0\_22 ! at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) ~! na:1.6.0\_22 ! at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) ~! na:1.6.0\_22 ! at java.lang.reflect.Constructor.newInstance(Unknown Source) ~! na:1.6.0\_22 ! at org.apache.felix.ipojo.InstanceManager.createObject(InstanceManager.java:667) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceManager.getPojoObject(InstanceManager.java:844) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.\_\_stateChanged(LifecycleCallbackHandler.java:156) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.Extender.parse(Extender.java:269) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.Extender.access$600(Extender.java:52) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682) ! org.apache.felix.ipojo-1.8.0.jar:na ! at java.lang.Thread.run(Unknown Source) ! na:1.6.0\_22 ! 2015-11-23 14:54:17,059 ERROR ! org-keridwen-core-ui-dockingframes.2.0.8 ! ! ERROR ! org.keridwen.core.ui.dockingframes.internal.DefaultMenuService : Cannot create a POJO instance, the POJO constructor has thrown an exception: Could not initialize class sun.awt.X11GraphicsEnvironment java.lang.RuntimeException: Cannot create a POJO instance, the POJO constructor has thrown an exception: Could not initialize class sun.awt.X11GraphicsEnvironment at org.apache.felix.ipojo.InstanceManager.createObject(InstanceManager.java:696) ~! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceManager.getPojoObject(InstanceManager.java:844) ~! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.\_\_stateChanged(LifecycleCallbackHandler.java:156) ~! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.handlers.lifecycle.callback.LifecycleCallbackHandler.stateChanged(LifecycleCallbackHandler.java) ~! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceManager.setState(InstanceManager.java:471) ~! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceManager.start(InstanceManager.java:353) ~! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:166) ~! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:301) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:238) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:343) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.Extender.parse(Extender.java:269) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:208) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.Extender.access$600(Extender.java:52) ! org.apache.felix.ipojo-1.8.0.jar:na ! at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:682) ! org.apache.felix.ipojo-1.8.0.jar:na ! at java.lang.Thread.run(Unknown Source) ! na:1.6.0\_22 ! 2015-11-23 14:54:17,059 ERROR ! org-keridwen-core-ui-dockingframes.2.0.8 ! ! ERROR ! org.keridwen.core.ui.dockingframes.internal.DefaultMenuService : Cannot create a POJO instance, the POJO constructor has thrown an exception: Could not initialize class sun.awt.X11GraphicsEnvironment 2015-11-23 14:54:17,060 ERROR ! org.apache.felix.ipojo.1.8.0 ! ! ERROR ! iPOJO Instance Creator : A matching factory was found for {component=org.keridwen.core.ui.dockingframes.internal.DefaultMenuService, instance.name=org.keridwen.core.ui.dockingframes.internal.DefaultMenuService-0}, but the instantiation failed : The configuration is not correct for the type org.keridwen.core.ui.dockingframes.internal.DefaultMenuService : Cannot create a POJO instance, the POJO constructor has thrown an exception: Could not initialize class sun.awt.X11GraphicsEnvironment 2015-11-23 14:54:17,076 TRACE invalid link : BundleController:GMSH exucution module(Illegal character in opaque part at index 21: BundleController:GMSH exucution module) controller associated with GMSH exucution module is created 2015-11-23 14:54:17,080 TRACE ! org.keridwen.core.messaging.internal.CoreEventDispatcher ! GMSH exucution module registered 2015-11-23 14:54:17,089 TRACE invalid link : BundleController:Keridwen Group Editor module(Illegal character in opaque part at index 25: BundleController:Keridwen Group Editor module) controller associated with Keridwen Group Editor module is created 2015-11-23 14:54:17,090 TRACE ! org.keridwen.core.messaging.internal.CoreEventDispatcher ! Keridwen Group Editor module registered 2015-11-23 14:54:17,097 TRACE invalid link : BundleController:Live monitoring(Illegal character in opaque part at index 21: BundleController:Live monitoring) controller associated with Live monitoring is created 2015-11-23 14:54:17,098 TRACE ! org.keridwen.core.messaging.internal.CoreEventDispatcher ! Live monitoring registered 2015-11-23 14:54:17,413 TRACE ! BundleController:UI2NUM ! controller associated with UI2NUM is created 2015-11-23 14:54:17,415 TRACE ! org.keridwen.core.messaging.internal.CoreEventDispatcher ! UI2NUM registered 2015-11-23 14:54:17,422 TRACE invalid link : BundleController:SPIS Model(Illegal character in opaque part at index 21: BundleController:SPIS Model) controller associated with SPIS Model is created 2015-11-23 14:54:17,423 TRACE ! org.keridwen.core.messaging.internal.CoreEventDispatcher ! SPIS Model registered

Message by Fredrik Johansson:
I should mention that if I try to copy the same simulation, and run it with the same command (below) on a different computer that has X11 enabled, it runs fine. I can see it calling the my Xprogram though, albeit with no output.
sh SpisGeoNo3D.sh -p $SCRATCH/RC-PAU_100_1_20Nov15-1.spis5
I don’t understand why. I hope the error log will tell you why. If it’s any help, I usually define the simulation with the GUI, save and exit SPIS before running and then run it via the -p option. I also sometimes copy a successful simulation, change some parameters in the globalparameters.xml file and then rerrun it with the -p option with great success. But on this server, none of these methods seem to work

Message by ruard:
Hi Fredrik,
I think it is a bug on the spis side. In some configurations, it is possible to have a progress bar displayed during your simulation. We should avoid it in batch mode. The question is what is this specific configuration leading to an error?
I will try to debug it for the next release.
Thanks for your feed back.
Benjamin

Message by Fredrik Johansson:
Hi Benjamin. Small update: Thanks to some help (I take no credit for this), I edited the SpisGeoNo3D.sh script to include this:
p)
./dependencies/thirdparty/jre-1.6.0_22-linux64b/bin/java -Xmx120024M -jar -Djava.awt.headless=true -Dspis.timestamp=$NOW -Dlogback.configurationFile=resources/logging/logback-headless.xml -Dfelix.config.properties=file:resources/felix/config.properties -Dactivate3DViews=false -Dorg.keridwen.config=./resources/org-spis-geo-linux64b.properties -Dorg.keridwen.headless=true -Dorg.spis.batch.project.path=$PATH_CORRECTED dependencies/thirdparty/felix-4.2.1-patched/felix.jar
exit 0
note the -Djava.awt.headless=true argument. With this, the simulation runs great without X11. I at least haven’t found any fatal bugs.
Best regards,
Fredrik

Message by ruard:
Dear Fredrik,
Thank you for your feedbacks. I will add this new argument in the next release.
Thank you for your help.
Regards,
Benjamin

Message by EW:
Thank you for posting this solution! I was having the same problem and this fixed it.