|
From: Fuad A. <fua...@gm...> - 2020-03-31 06:06:58
|
your solution run well but i have another error. for read config file.
my error is
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at
com.dxtr.fastmatch.FastmatchMDRequest.<init>(FastmatchMDRequest.java:14)
at
com.dxtr.fastmatch.FastmatchMDRequest.main(FastmatchMDRequest.java:19)
and my config file code is here
public TestMarketdataRequest(String configFile) {
try {
System.out.println(" Config File " + configFile);
Properties props = new Properties();
try {
props.load(new FileInputStream(configFile));
} catch (IOException e) {
e.printStackTrace();
}
SenderCompID = props.getProperty("SenderCompID");
TargetCompID = props.getProperty("TargetCompID");
symbols = props.getProperty("Symbols");
System.out.println(" FIX Port " +
props.getProperty("SocketConnectPort"));
System.out.println(" FIX IP " +
props.getProperty("SocketConnectHost"));
System.out.println(" SenderCompID " + SenderCompID + "
TargetCompID " + TargetCompID);
SessionSettings settings = new SessionSettings(configFile);
MessageStoreFactory messageStoreFactory = new
FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
Initiator initiator = new SocketInitiator((Application) this,
messageStoreFactory, settings, logFactory, messageFactory);
initiator.start();
and this is the args[0]
public static void main(String[] args){
String configFile = args[0];
new TestMarketdataRequest(configFile);
}
and my error is in this code
public class FastmatchMDRequest {
public FastmatchMDRequest(String args[]){
System.out.println("Application: TestMarketdataRequest ");
new TestMarketdataRequest(args[0]);
}
public static void main(String args[]){
new FastmatchMDRequest(args);
}
}
what is the problem from this ? i have add my config file as my resources
and build it in one jar.
best regards,
Fuad
Pada tanggal Sen, 30 Mar 2020 pukul 21.13 Fuad Azhar <fua...@gm...>
menulis:
> Oh I see... Thanks for discuss Christoph... I will try it tomorrow morning
> on Indonesia time... I will update the result... Many thanks for you...
>
> On Mon, Mar 30, 2020, 20:50 Christoph John <chr...@ma... wrote:
>
>> When there is no match, then the class is not in the JAR and that is
>> because you get a ClassNotFound.
>>
>> Here is how you can package all your dependencies in an executable JAR:
>>
>> https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-jar-with-dependencies-using-maven
>>
>>
>>
>>
>> On 30.03.20 15:39, Fuad Azhar wrote:
>>
>> here my screenshot for eclipse
>> i have add all libraries. but when i create jar and grep it using your
>> command line i got this one
>>
>> fuad@fuad-Inspiron-3476:~/Documents/fastmatchmarketdata/target$ jar tfv
>> fastmatchmarketdata-0.0.1-SNAPSHOT.jar | grep MessageStoreFactory
>> for this one there is not any answer but when i only check all of jar
>> there is any like this example :
>> fuad@fuad-Inspiron-3476:~/Documents/fastmatchmarketdata/target$ jar tfv
>> fastmatchmarketdata-0.0.1-SNAPSHOT.jar
>> 249 Mon Mar 30 19:59:50 WIB 2020 META-INF/MANIFEST.MF
>> 0 Mon Mar 30 19:59:50 WIB 2020 META-INF/
>> 0 Mon Mar 30 19:56:34 WIB 2020 com/
>> 0 Mon Mar 30 19:56:34 WIB 2020 com/dxtr/
>> 0 Mon Mar 30 19:56:34 WIB 2020 com/dxtr/fastmatch/
>> 0 Mon Mar 30 19:56:34 WIB 2020
>> com/dxtr/fastmatch/marketdatarequestapps/
>> 0 Mon Mar 30 19:56:34 WIB 2020 com/dxtr/marketdatarequest/
>> 0 Mon Mar 30 19:56:34 WIB 2020 com/dxtr/marketdatarequest/fastmatch/
>> 0 Mon Mar 30 19:59:50 WIB 2020 META-INF/maven/
>> 0 Mon Mar 30 19:59:50 WIB 2020
>> META-INF/maven/com.dxtr.marketdatarequest/
>> 0 Mon Mar 30 19:59:50 WIB 2020
>> META-INF/maven/com.dxtr.marketdatarequest/fastmatchmarketdata/
>> 1098 Mon Mar 30 19:58:34 WIB 2020
>> com/dxtr/fastmatch/marketdatarequestapps/TestMarketdataRequest$1.class
>> 11666 Mon Mar 30 19:58:34 WIB 2020
>> com/dxtr/fastmatch/marketdatarequestapps/TestMarketdataRequest.class
>> 749 Mon Mar 30 19:58:34 WIB 2020
>> com/dxtr/fastmatch/FastmatchMDRequest.class
>> 130005 Mon Mar 30 19:56:34 WIB 2020
>> com/dxtr/marketdatarequest/fastmatch/FIX42.XML
>> 354 Mon Mar 30 19:56:34 WIB 2020
>> com/dxtr/marketdatarequest/fastmatch/initiator.config
>> 354 Mon Mar 30 19:56:34 WIB 2020
>> com/dxtr/marketdatarequest/fastmatch/initiator.cfg
>> 120 Mon Mar 30 19:59:08 WIB 2020
>> META-INF/maven/com.dxtr.marketdatarequest/fastmatchmarketdata/pom.properties
>> 6469 Mon Mar 30 19:56:24 WIB 2020
>> META-INF/maven/com.dxtr.marketdatarequest/fastmatchmarketdata/pom.xml
>>
>> i also attach my maven depedencies with have i add. so how to fix my
>> problem ?
>>
>> Pada tanggal Sen, 30 Mar 2020 pukul 20.28 Christoph John <
>> chr...@ma...> menulis:
>>
>>> Are you sure your JAR contains all needed libraries?
>>> Could you do a "jar tfv <jarfile> | grep MessageStoreFactory" on your
>>> JAR file? Is there any output?
>>>
>>>
>>>
>>> On 30.03.20 15:13, Fuad Azhar wrote:
>>>
>>> first i build my apps in my local laptop my local environment is OpenJDK
>>> Runtime Environment (build 1.8.0_242-8u242-b08-0ubuntu3~18.04-b08) in local
>>> i use eclipse for build this java apps jar
>>> after that i scp my jar to our staging server. and my staging server use
>>> aws server and i run my apps using java -jar xxxx.jar but when i run it i
>>> got error like that.
>>> so how to solved the problem ? thanks for your help christoph.john
>>>
>>> Pada tanggal Sen, 30 Mar 2020 pukul 20.01 Christoph John <
>>> chr...@ma...> menulis:
>>>
>>>> This has to be something special to your runtime environment and does
>>>> not look like a QuickFIX/J.
>>>>
>>>> How do you run your application? Do you start it from the command line
>>>> or do you deploy your application to some application server?
>>>>
>>>>
>>>> On 30.03.20 14:45, Fuad Azhar wrote:
>>>>
>>>> i have add quickfixj-message-fix42.2.1.1.jar also quickfixj-core and
>>>> all of required but when i run i got that error again and again... how to
>>>> fix it
>>>>
>>>> Pada tanggal Sen, 30 Mar 2020 pukul 19.40 Christoph John <
>>>> chr...@ma...> menulis:
>>>>
>>>>> I guess the solution is the same as before, but probably you need to
>>>>> include another JAR file. I guess quickfixj-core.
>>>>>
>>>>>
>>>>> On 30.03.20 13:34, Fuad Azhar wrote:
>>>>>
>>>>> QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
>>>>> QuickFIX/J Support: http://www.quickfixj.org/support/
>>>>>
>>>>>
>>>>> Hi thanks for answer that my problem about JNI... now i have different
>>>>> error from my apps.
>>>>> i have add quickfixj-messages-fix42.2.1.1.jar but when i try run my
>>>>> apps i have problem like this one
>>>>>
>>>>> Exception in thread "main" java.lang.NoClassDefFoundError:
>>>>> quickfix/MessageStoreFactory
>>>>> at
>>>>> com.dxtr.fastmatch.FastmatchMDRequest.<init>(FastmatchMDRequest.java:14)
>>>>> at
>>>>> com.dxtr.fastmatch.FastmatchMDRequest.main(FastmatchMDRequest.java:19)
>>>>> Caused by: java.lang.ClassNotFoundException:
>>>>> quickfix.MessageStoreFactory
>>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
>>>>> at
>>>>> sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
>>>>> ... 2 more
>>>>>
>>>>> how to solved my problem ?
>>>>>
>>>>> Pada tanggal Sen, 30 Mar 2020 pukul 18.04 Aidan Nutley <
>>>>> an...@fi...> menulis:
>>>>>
>>>>>> QuickFIX/J Documentation: http://www.quickfixj.org/documentation/
>>>>>> QuickFIX/J <http://www.quickfixj.org/documentation/QuickFIX/J>
>>>>>> Support: http://www.quickfixj.org/support/
>>>>>>
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> Take a look
>>>>>>
>>>>>> https://stackoverflow.com/questions/22381202/a-jni-error-has-occurred-please-check-your-installation-and-try-again-in-eclips
>>>>>>
>>>>>> Thanks
>>>>>> Aidan
>>>>>>
>>>>>
>>>>>
>>>> --
>>>> Christoph John
>>>> Software Engineering
>>>> T +49 241 557...@ma...
>>>>
>>>> MACD GmbH
>>>> Oppenhoffallee 103
>>>> 52066 Aachen, Germanywww.macd.com
>>>>
>>>> Amtsgericht Aachen: HRB 8151
>>>> Ust.-Id: DE 813021663
>>>> Geschäftsführer: George Macdonald
>>>>
>>>>
>>> --
>>> Christoph John
>>> Software Engineering
>>> T +49 241 557...@ma...
>>>
>>> MACD GmbH
>>> Oppenhoffallee 103
>>> 52066 Aachen, Germanywww.macd.com
>>>
>>> Amtsgericht Aachen: HRB 8151
>>> Ust.-Id: DE 813021663
>>> Geschäftsführer: George Macdonald
>>>
>>>
>> --
>> Christoph John
>> Software Engineering
>> T +49 241 557...@ma...
>>
>> MACD GmbH
>> Oppenhoffallee 103
>> 52066 Aachen, Germanywww.macd.com
>>
>> Amtsgericht Aachen: HRB 8151
>> Ust.-Id: DE 813021663
>> Geschäftsführer: George Macdonald
>>
>>
|