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
at hla.rti1516e.RtiFactoryFactory.getRtiFactory(RtiFactoryFactory.java:48)
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 )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
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
at hla.rti1516e.RtiFactoryFactory.getRtiFactory(RtiFactoryFactory.java:48)
This is the line that generates the exception:
private RTIambassador rtiamb = RtiFactoryFactory.getRtiFactory().getRtiAmbassador();
What mistake have I done?
Thank you in advance.
Ox.
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.