I'm trying to realize a simple example in HLA EVOLVED, using ieee1516e.jar and a Pitch RTI.
I get this runtime exception:
Exception in thread "main" hla.rti1516e.exceptions.RTIinternalError: Cannot find factory
This is the line that generates the exception:
private RTIambassador rtiamb = RtiFactoryFactory.getRtiFactory().getRtiAmbassador();
What mistake have I done?
Thank you in advance.
The ServiceLoader needs a file specifing which class implements the interface RTIFactory.
To do this you have to do the following:
1. Locate where your .class files are. This is your main classpath
2. Create subfolders: META-INF/services
3. in this directory create a file with the name hla.rti1516e.RtiFactory
4. write the full qualified name (including package names) of a class that implements the interface RtiFactory in that file. (e.g. net.sf.ohla.rti.hla.rti1516e.IEEE1516eRtiFactory )
You said 'Pitch' RTI, but did you mean 'OHLA' RTI?
If so, you need to include the ohla-rti.jar file on your classpath. The ohla-rti.jar file includes the file mentioned above (by Senfkoenig) and the ServiceLoader can then locate the proper class.
Log in to post a comment.