Read Resource file "RDMFieldDictionary" have some problem
In this method
QSConsumer.java
public void init()
{
String fieldDictionaryFilename = "../etc/RDM/RDMFieldDictionary";
String enumDictionaryFilename = "../etc/RDM/enumtype.def";
try
{
GenericOMMParser.initializeDictionary(fieldDictionaryFilename, enumDictionaryFilename);
}
catch (DictionaryException ex)
{
System.out.println("ERROR: Unable to initialize dictionaries");
System.out.println(ex.getMessage());
if(ex.getCause() != null)
System.err.println(": " + ex.getCause().getMessage());
cleanup();
return;
}
}
STEP1:
In this source code ,it wants to read RDMFieldDictionary ,
String fieldDictionaryFilename = "../etc/RDM/RDMFieldDictionary";
and i change the code to get the file's path like this
String fieldDictionaryFilename = Thread.currentThread().getContextClassLoader().getResource("rfa/RDMFieldDictionary").getFile();
and i got the result like this
/D:/workspace/xuntou-base-market/xuntou-base-market-facade/target/classes/rfa/RDMFieldDictionary
STEP2:
i start the project user Intellij (a IDE like Eclipse) in my own computer, it runs very well
public class RfaSubscribeThread implements Runnable{
public void run() {
// Create a demo instance
QSConsumer demo = new QSConsumer();
// Startup and initialization
demo.init();
//...
}
}
STEP3:
But when the project has become a Jar File,and start up on the Linux Mechine ,it give me some wrong info like this
ERROR: Unable to initialize dictionaries
ERROR: Check if files file:/usr/local/xuntou/base-market/xuntou-base-market-facade/lib/xuntou-base-market-facade-1.1.9-SNAPSHOT.jar!/rfa/RDMFieldDictionary and file:/usr/local/xuntou/base-market/xuntou-base-market-facade/lib/xuntou-base-market-facade-1.1.9-SNAPSHOT.jar!/rfa/enumtype.def exist and are readable.
: Dictionary file file:/usr/local/xuntou/base-market/xuntou-base-market-facade/lib/xuntou-base-market-facade-1.1.9-SNAPSHOT.jar!/rfa/RDMFieldDictionary does not exist.
RWF: 14.1
RFA: Version = 8.1.0.E2.all, Date = Wed May 02 18:30:50 CST 2018, Jar Path = /usr/local/xuntou/base-market/xuntou-base-market-facade/lib/rfa-1.0.0.jar, Jar Size = 1619345
class com.xuntou.platform.market.rfa.quickstart.QuickStartConsumer.QSConsumer exiting
STEP4:
I seach the internet ,fount in the jar file , use "new File("FilePath")" to get file is not right
i want to change ,but the source code
GenericOMMParser.initializeDictionary(fieldDictionaryFilename, enumDictionaryFilename);
only use "new File('FilePath')" to read the resource file
So, what can i do to avoid the problem.
TIPS: I can't change the source code, it's provided by your company
expect your help, thank you very much!
Best Answer
-
Hello @peng.xiaoliang
Please be informed that this is an expected behavior. The TREP Dictionary files (RDMFieldDictionary and enumtype.def files) are always updated (add new supported fields, fixed dictionary issue, etc) by TR, so the application should place Dictionary files outside the Jar file to let you can easy upgrade them without rebuild the Jar file. You can download the latest version of TREP dictionary file from the Customer Zone https://customers.reuters.com/a/support/technical/softwaredownload/Default.aspx link (Please select Category “MDS – General” and Products “TREP Template Service Pack”).
Please be informed that the RFA API is a feature-completed API. The current strategic API is Elekton Message API (EMA Java API) which is a part of the strategic Elektron SDK family. You can find more detail regarding the EMA Java from the following resources
- Elektron SDK – Java site
- Developer Webinar: Introduction to Enterprise App Creation With Open-Source Elektron Message API
- Developer Webinar Recording: Why migrate from RFA to EMA API?
0
Answers
-
Hello @peng.xiaoliang
I can replicate the issue with the given code. When the application keeps Dictionary files with resources folder and build jar file, the following code cannot access Dictionary files inside jar file:
fieldDictionaryFilename = Thread.currentThread().getContextClassLoader().getResource("etc/RDMFieldDictionary").getFile();
enumDictionaryFilename = Thread.currentThread().getContextClassLoader().getResource("etc/enumtype.def").getFile();Then I got the following error message when I try to run the jar file.
ERROR: Unable to initialize dictionaries
ERROR: Check if files file:/D:/Project/SRs/AHS_27324/Code/RFA_code/out/artifacts
/RFA_OMM_AHS_27324_jar/RFA_OMM_AHS_27324.jar!/etc/RDMFieldDictionary and file:/D
:/Project/SRs/AHS_27324/Code/RFA_code/out/artifacts/RFA_OMM_AHS_27324_jar/RFA_OM
M_AHS_27324.jar!/etc/enumtype.def exist and are readable.
: Dictionary file file:/D:/Project/SRs/AHS_27324/Code/RFA_code/out/artifacts/RFA
_OMM_AHS_27324_jar/RFA_OMM_AHS_27324.jar!/etc/RDMFieldDictionary does not exist.I will check this behavior in detail and let you know updates.
0 -
it confused me. I still don't know how to solve this problem. The jar file and source code is provided, the only way to read the dictionary file is use the source code which is provided.
0 -
Publish the project to the internet must park the source code to JAR file, but in the jar file ,it can't read the dictionary file . The helper website i can't open it .because of the GFW
0 -
Hello @peng.xiaoliang
The dictionary files are not designed to be inside the application Jar file because they are designed to be easy updated by just replacing the files. The application should place dictionary files outside the Jar file and read them from that location.
0
Categories
- All Categories
- 6 AHS
- 39 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 60 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛