Issue using the headless tag when running in a command line

72 views
Skip to first unread message

max dom

unread,
May 16, 2025, 8:12:50 PMMay 16
to JaamSim Users Discussion Group
Hi all,

Im building a model that is used to simulate the logistics of pipe supply units that transport pipes between a yard and a pipelay vessel. 

When developing this model I rely on a python scripts to adjust certain variables in my config file after which I run the model using: 
def run_simulation():
    # Run actual logistics simulation
    proc = subprocess.run(
        ["java", "-jar", "jaamsim\JaamSim2025-04.jar", "jaamsim\simulation\pipehaul.cfg", "-b"],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE
    )
This works perfect and produces the results on which I do analysis later.

For the next step I wanted to run the model in a linux virtual machine. Here I wanted to use the headless tag since the linux vm cannot handle the GUI. Here I started experiencing a weird bug with the output of the model. For RunOutputList I have some custom outputs that look like this: 
{ '[PSU1].CloneList(1).StateTimes("WaitingAtYard")/1[h]' }
{ '[PSU1].CloneList(1).StateTimes("PipeLoading")/1[h]' }
{ '[PSU1].CloneList(1).StateTimes("TransitToPLV")/1[h]' }
{ '[PSU1].CloneList(1).StateTimes("WaitingAtPLV")/1[h]' }
{ '[PSU1].CloneList(1).StateTimes("PipeUnloading")/1[h]' }
{ '[PSU1].CloneList(1).StateTimes("TransitToYard")/1[h]' }
{ '[PSU1].CloneList(1).StateTimes("Bunkering")/1[h]' }
etc for all my ships. 

When running with the batch tag this works great. But when I use the tag headless the following error is written to the log file of the simulation:

Runtime error in replication 1 of scenario 1 at time 1209600.000000 s:
Simulation keyword 'RunOutputList', index (1):
Can not look up output on non-entity type
Stack trace:
com.jaamsim.input.ExpEvaluator$EntityResolver.resolve(ExpEvaluator.java:331)
com.jaamsim.input.ExpParser$ResolveOutput.evaluate(ExpParser.java:465)
com.jaamsim.input.ExpParser$IndexCollection.evaluate(ExpParser.java:556)
com.jaamsim.input.ExpParser$BinaryOp.evaluate(ExpParser.java:776)
com.jaamsim.input.ExpParser$Expression.evaluate(ExpParser.java:215)
com.jaamsim.input.ExpEvaluator.evaluateExpression(ExpEvaluator.java:421)
com.jaamsim.StringProviders.StringProvExpression.getNextValue(StringProvExpression.java:155)
com.jaamsim.StringProviders.StringProvListInput.getNextValue(StringProvListInput.java:193)
com.jaamsim.basicsim.Simulation.getRunOutputValues(Simulation.java:986)
com.jaamsim.basicsim.SimRun.runEnded(SimRun.java:100)
com.jaamsim.basicsim.JaamSimModel.endRun(JaamSimModel.java:718)
com.jaamsim.basicsim.EndModelTarget.process(EndModelTarget.java:37)
com.jaamsim.events.EventManager.executeTarget(EventManager.java:178)
com.jaamsim.events.EventManager.execute(EventManager.java:272)
com.jaamsim.events.Process.run(Process.java:98)

So the model suddenly does not see PSU1 as an entity which is weird since it is an entity container. 

So when using the tag -batch the whole setup works great. As soon as I use -headless something breaks. Does anyone have any idea why this might be and how to fix it? Or maybe confirm that it is a software bug.

Greetings Max Dom

Mark

unread,
May 17, 2025, 7:35:02 PMMay 17
to JaamSim Users Discussion Group
Just up-voting the fact that the GUI not working in a Linux VM is frustrating.  I had previously experienced that problem on a Windows Server running Oracle Virtual Box and Ubuntu Desktop 22.04/24.04 and OpenJDK, but if I remember correctly it was caused by some sort of issue between either JOGL or the Java GUI and X11.  Spent a while looking at forum posts and it didn't seem like something that would be easy to resolve.  It was easy to reproduce though - just try running JaamSim from the .jar file as usual within the VM.  Perhaps Harvey could take a look at it and chime-in.

Harry King

unread,
May 19, 2025, 1:39:35 PMMay 19
to JaamSim Users Discussion Group
Max,

I'm not sure what is happening here, but the error message will be the result of [PSU1].CloneList returning an empty list. In this case, the index (1) of the empty list will return the number zero (instead of an index out of bound error). Since the number zero is not an object, you get the "Can not look up output on non-entity type" error message when the expression attempts to look up the output 'StateTimes'.

It would be helpful if you could confirm this theory by replacing the contents of your RunOutputList with { [PSU1].CloneList }. If correct, then the problem is either that the CloneList output does not work correctly under the headless option or that one of your runs correctly returns an empty CloneList and that the error condition is handled more gracefully when the GUI is present.

Harry

Harry King

unread,
May 19, 2025, 4:17:15 PMMay 19
to JaamSim Users Discussion Group
Mark,

I don't think I understand your comment. The View windows with their 3D graphics are never going to work within a VM that doesn't support 3D graphics. I would be possible to launch the rest of the GUI assuming that the VM supports the Java AWI, but that doesn't seem to provide much value without 3D graphics. You wouldn't be able to drag and drop, but you could select an object with the Object Selector window and see its inputs and outputs in the Input Viewer and Output Viewer.

If you just want to churn through a bunch of scenarios, then you can launch JaamSim in headless mode.

Harry

max dom

unread,
May 20, 2025, 5:59:43 AMMay 20
to JaamSim Users Discussion Group
Hi Harry, 
Yes your suspicion is correct. When I try [PSU1].CloneList, in headless model, I get back an empty list. When I try the same in batch mode it returns a list of 1 with PSU1_1 which makes sense. Meaning that using headless mode breaks something in the clonelist output.

Do you have a suggestion for a work around until the next release?

Thanks 
Max

Op maandag 19 mei 2025 om 19:39:35 UTC+2 schreef d.harr...@gmail.com:

Harry King

unread,
May 20, 2025, 12:29:07 PMMay 20
to JaamSim Users Discussion Group
Max,

It would be best if you email your model to me directly so that I can identify the problem.

Harry

Harry King

unread,
May 29, 2025, 12:30:32 PMMay 29
to JaamSim Users Discussion Group
The problem is the CloneList output. Everything else works correctly.

This bug will be fixed in the next release, but in the meantime you can replace [PSU1].CloneList with [PSU1Generator].obj in the RunOutputList input. This works fine as long as only one entity is generated.

Harry

max dom

unread,
May 31, 2025, 5:39:30 AMMay 31
to JaamSim Users Discussion Group
Yes this works. Thanks for the workaround Harry.

Max

Op donderdag 29 mei 2025 om 18:30:32 UTC+2 schreef d.harr...@gmail.com:

Harry King

unread,
Jun 5, 2025, 1:41:13 PMJun 5
to JaamSim Users Discussion Group
The problem with CloneList in headless mode has been fixed in release 2025-05.

Harry

Mark

unread,
Aug 2, 2025, 11:55:53 AMAug 2
to JaamSim Users Discussion Group
I think you're confusing Ubuntu Server (command line interface, doesn't support 3D graphics) with Ubuntu Desktop (GUI, supports 3D graphics).

I tested the new version of JaamSim that Harvey has made (from the following thread) on the most recent version of Oracle Virtual Box, and it seems that the issue is now resolved, whether it was a JOGL error or a VirtualBox error I can't be sure.  It should now be possible to run the JaamSim GUI inside of a VirtualBox Ubuntu Desktop 24.04 VM on a Windows Server host.

https://groups.google.com/g/jaamsim-users/c/yqbV_Hv0vfg
Reply all
Reply to author
Forward
0 new messages