Repast / repast.simphony

Git repository for Repast Simphony development
repast.github.io
90 stars 21 forks source link

Labels in 3D display throws exception #51

Closed etatara closed 2 years ago

etatara commented 2 years ago

When enabling an agent label in the 3D Cartesian display, an exception is thrown:

ERROR [AWT-EventQueue-0] 12:12:13,565 repast.simphony.visualization.engine.DisplayComponentControllerAction - Error while creating displays java.lang.IllegalStateException: No GeometryService implementation found. Please add j3d-core-utils to the classpath. at org.jogamp.java3d.Font3D.newGeometryService(Font3D.java:956) at org.jogamp.java3d.Font3D.triangulateGlyphs(Font3D.java:471) at org.jogamp.java3d.Text3DRetained.updateCharacterData(Text3DRetained.java:700) at org.jogamp.java3d.Text3DRetained.setString(Text3DRetained.java:254) at org.jogamp.java3d.Text3D.(Text3D.java:276) at repast.simphony.visualization.visualization3D.AbstractLabel.getBranchGroup(AbstractLabel.java:159)

etatara commented 2 years ago

This is due to a change in Java3D such that the Font3D classes uses a java service loader to find a class, but the service loader uses the default Java class loader instead of the Repast class loader, causing the class not found exception. I've included call to setContextClassLoader in the AbstractLabel class for the 3D displays that solves the issue:

Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());