Skip to main content

"J3D-GeometryStructureUpdateThread-1" java.lang.NullPointerException

2 replies [Last post]
tomindosity
Offline
Joined: 2008-05-22
Points: 0

Hi all

I have a problem with the a "J3D-GeometryStructureUpdateThread-1" java.lang.NullPointerException. It occurs when moving BranchGroups within the scene graph (using the method "moveTo" of the "Group" class) upon a mouse clicking event.

The BranchGroup that is being moved within the scene graph has a collision detection behavior attached, which seems to be the reason for the exception. The below attached stacktrace indicates that the collision detection processing leads to the exception.

As the above exception does not occur every time the user clicks, I assume that it's a synchronization issue within Java3D.

Any work arounds or bug reports known?

Thanks so much
Tom

Full exception (using Java3d 1.5.):

Exception in thread "J3D-GeometryStructureUpdateThread-1" java.lang.NullPointerException
at javax.media.j3d.BHTree.selectAny(BHTree.java:217)
at javax.media.j3d.GeometryStructure.collide(GeometryStructure.java:1075)
at javax.media.j3d.GeometryStructure.processCollisionDetection(GeometryStructure.java:958)
at javax.media.j3d.GeometryStructure.processMessages(GeometryStructure.java:213)
at javax.media.j3d.StructureUpdateThread.doWork(StructureUpdateThread.java:83)
at javax.media.j3d.J3dThread.run(J3dThread.java:256)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kcr
Offline
Joined: 2004-03-17
Points: 0

Are you detaching the BranchGroup in the Swing EventDispatchThread? The only safe way to detach a BranchGroup from a live scene is to do it from a behavior. See issue 193:

https://java3d.dev.java.net/issues/show_bug.cgi?id=193

-- Kevin

tomindosity
Offline
Joined: 2008-05-22
Points: 0

Hi Kevin

I did all the changes in the behavior (removals and moveTos). As the exceptions became more frequent the bigger the scene graph grew, I hinted at a synchronization issue (as you referred to). However, I am pretty sure I am invoking all these methods within the correct behavior executiobn thread.
I now tried to minimize the amount of changes during behavior execution in the scene graph. This workaround seems to be fine.

Thanks for your feedback
Thomas