Each call to jpsBaseLibGW.launchGateway starts a new Java Virtual Machine (JVM) and if you create a Java object in one and then try to pass it to the other then bad things will probably happen.
The solution is to make this function create a singleton object that is initialised once and then just returned on subsequent calls.
As discussed, the issue is because a new Java gateway object is created when calling JpsBaseLib() which makes Java objects in different JVMs get passed across.
Each call to
jpsBaseLibGW.launchGateway
starts a new Java Virtual Machine (JVM) and if you create a Java object in one and then try to pass it to the other then bad things will probably happen. The solution is to make this function create a singleton object that is initialised once and then just returned on subsequent calls.