Can't reference an xml into the xml used by recording service

3 posts / 0 new
Last post
Offline
Last seen: 4 years 9 months ago
Joined: 07/22/2019
Posts: 11
Can't reference an xml into the xml used by recording service

Hi, 

 

I generated my xml files from my idl's and stored them in a folder called xml. This folder lives in the same directory as my MY_RECORDING_SERVICE.xml. It looks like this

main_folder/

|---xml/

|------image.xml

|------image_types.xml

|------coordinate_systems.xml

|---MY_RECORDING_SERVICE.xml

 

Inside my MY_RECORDING_SERVICE.xml I'm including these xml generated as follow: 

 

<types>
<include file="./xml/image.xml"/>
<include file="./xml/image_types.xml"/>
<include file="./xml/coordinate_systems.xml"/>
</types>

However, when I run the recording service, the program doesn't seem to recognize the location, I get this error: 

 

[/recording_services/ImageFileWriterJson|CREATE]
[/recording_services/ImageFileWriterJson|CREATE] product='RTI Recording Service', version=6.0.0.0, config_name=ImageFileWriterJson, app_name='', arch=x64Linux2.6gcc4.4.5, build=NDDSC_BUILD_6.0.0.0_20190301T054126Z_RTI_REL, user='', host='L4DLAVYLINUX', process_id=12644
[/recording_services/ImageFileWriterJson|CREATE] load file='/opt/dds-rti/resource/xml/RTI_RECORDING_SERVICE.xml'
[/recording_services/ImageFileWriterJson|CREATE] load_default_files:file USER_RECORDING_SERVICE.xml not found
[/recording_services/ImageFileWriterJson|CREATE] load file='MY_RECORDING_SERVICE.xml'
[/recording_services/ImageFileWriterJson|CREATE] DDS_XMLFileInfoList_assertFile:!open file: coordinate_systems.xml
[/recording_services/ImageFileWriterJson|CREATE] DDS_XMLInclude_initialize:!assert file info
[/recording_services/ImageFileWriterJson|CREATE] DDS_XMLInclude_new:!init XML include object
[/recording_services/ImageFileWriterJson|CREATE] RTIXMLParser_onStartTag:Parse error at line 3: Error processing tag 'include'
[/recording_services/ImageFileWriterJson|CREATE] RTIXMLParser_parseFromFile_ex:Parse error in file './xml/image.xml'
[/recording_services/ImageFileWriterJson|CREATE] DDS_XMLTypeCodeParser_parse_from_file:Error parsing XML
[/recording_services/ImageFileWriterJson|CREATE] DDS_XMLInclude_initialize:Parse error at line 7: error parsing './xml/image.xml'
[/recording_services/ImageFileWriterJson|CREATE] DDS_XMLInclude_new:!init XML include object
[/recording_services/ImageFileWriterJson|CREATE] RTIXMLParser_onStartTag:Parse error at line 7: Error processing tag 'include'
[/recording_services/ImageFileWriterJson|CREATE] RTIXMLParser_parseFromString_ex:error parsing XML string
[/recording_services/ImageFileWriterJson|CREATE] ROUTERCfgFileParser_generateNativeExtensionObject:!parse QoS configuration
[/recording_services/ImageFileWriterJson|CREATE] ROUTERCfgFileParser_initializeExtensionsI:!generate QoS
[/recording_services/ImageFileWriterJson|CREATE] ROUTERCfgFileParser_loadString:!init parser extensions
[/recording_services/ImageFileWriterJson|CREATE] ROUTERService_load:!load string
[/recording_services/ImageFileWriterJson|CREATE] ROUTERService_initialize:!load service
[/recording_services/ImageFileWriterJson|CREATE] ROUTERService_newWithDescription:!init service
[/recording_services/ImageFileWriterJson|CREATE] RTI_RoutingService_new_from_description:!init routing service
main:!Service:!create native router

How can I reference a path where to load these xml files? 

Fernando Garcia's picture
Offline
Last seen: 3 months 3 weeks ago
Joined: 05/18/2011
Posts: 200

Hi David,

I think the XML parser embedded in Recording Service would try to load relative files from the working directory. Could you try running Recording Service from main_folder?

Probably the best option would be to provide Recording Service with absolute paths. If you want prefer not to hardcode those absolute paths, you can use environment variables in the XML files using the format $(ENV_VARIABLE_NAME). You can actually pass the value of those variables to the Recording Service executable at startup time using command like arguments like-DENV_VARIABLE_NAME=value.

Let me know if this helps.

Fernando.

Offline
Last seen: 4 years 9 months ago
Joined: 07/22/2019
Posts: 11

Hi Fernando, 

Having my Recording XML file and the IDL XML files in the same folder does work. My problem is that the system we're building will have a different location of the XML files and I'm trying to reference these files from an external folder. 

I have tried using the absolute path, but it still gives me the same error that it can't find the file. Something I noticed is that when the XML files exist in that external location and also in the same folder as MY_RECORDING_SERVICE.xml the recording service works just fine. But having the XML in the same folder also defeats the purpose of what I'm trying to do. 

Regarding the second method you're suggesting, I don't think I'm doing it right, can you tell me if this is the correct usage of the env variables? 

 

<types>
<include file="${image_xml}"/>
<include file="${image_types_xml}"/>
<include file="${coordinate_systems_xml}"/>
</types>

And I'm running recording service as: 

/opt/dds-rti/bin/rtirecordingservice -Dimage_xml=/usr/local/include/.../xml/image.xml -Dimage_types_xml=/usr/local/include/.../xml/image_types.xml -Dcoordinate_systems_xml=/usr/local/include/.../xml/coordinate_systems.xml -cfgFile MY_RECORDING_SERVICE.xml -cfgName ImageFileWriterJson -domainIdBase 41

Thank you