|
From: Fuad A. <fua...@gm...> - 2020-03-30 13:05:44
|
i have add
quickfixj-messages-fix42-2.1.1.jar,quickfixj-core-2.1.1.jar,quickfixj-messages-all-2.1.1.jar
and slf4j and mina core but my error is same as
Application: TestMarketdataRequest
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
here my code
package com.dxtr.fastmatch;
import com.dxtr.fastmatch.marketdatarequestapps.TestMarketdataRequest;
/**
* Created by Fuad on 30/03/2020.
*/
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);
}
}
and here my class application
package com.dxtr.fastmatch.marketdatarequestapps;
import quickfix.*;
import quickfix.Message.Header;
import quickfix.field.*;
import quickfix.fix42.*;
import quickfix.Application;
import quickfix.fix42.Message;
import quickfix.MessageFactory;
import quickfix.field.SenderCompID;
import quickfix.field.TargetCompID;
import quickfix.MessageStoreFactory;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.UUID;
public class TestMarketdataRequest {
private final DefaultMessageFactory messageFactory = new
DefaultMessageFactory();
private boolean isAvailable = true;
private boolean isMissingField;
private String symbols;
private String SenderCompID;
private String TargetCompID;
private static volatile SessionID sessionID;
public void fromAdmin(quickfix.Message message, SessionID sessionID)
throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue, RejectLogon {
// TODO Auto-generated method stub
System.out.println("Successfully called fromAdmin for sessionId : "
+ message);
}
public void fromApp(quickfix.Message message, SessionID sessionID)
throws FieldNotFound, IncorrectDataFormat, IncorrectTagValue,
UnsupportedMessageType {
try {
String symbol = message.getString(Symbol.FIELD);
System.out.println(" FromApp " + message);
message.getString(TransactTime.FIELD);
// String seqNo = message.getString(MsgSeqNum.FIELD);
double bid = message.getDouble(MDEntryPx.FIELD);
double ask = message.getDouble(MDEntryPx.FIELD);
// System.out.println(seqNo + " " + message);
} catch (FieldNotFound fieldNotFound) {
fieldNotFound.printStackTrace();
}
}
public void onCreate(SessionID sessionID) {
// TODO Auto-generated method stub
System.out.println("Successfully called onCreate for sessionId : "
+ sessionID);
}
public void onLogon(SessionID sessionID) {
// TODO Auto-generated method stub
TestMarketdataRequest.sessionID = sessionID;
Session s = Session.lookupSession(sessionID);
UUID uuid = UUID.randomUUID();
String randomUUIDString = uuid.toString();
Message message = new Message();
quickfix.fix42.MarketDataRequest.NoMDEntryTypes group =
new quickfix.fix42.MarketDataRequest.NoMDEntryTypes();
quickfix.fix42.MarketDataRequest.NoRelatedSym group1 =
new quickfix.fix42.MarketDataRequest.NoRelatedSym();
MarketDataRequest marketdatarequest = new MarketDataRequest();
Header header = marketdatarequest.getHeader();
header.setField(new BeginString("FIX.4.2"));
header.setField(new SenderCompID("MDValueTrade2UAT1"));
header.setField(new TargetCompID("Fastmatch1"));
header.setField(new MsgType("V"));
message.setField(new MDReqID(randomUUIDString));
message.setField(new SubscriptionRequestType((char) 1));
message.setField(new MarketDepth(1));
message.setField(new NoMDEntryTypes(1));
group.setField(new MDEntryType((char) 1));
message.addGroup(group);
group1.setField(new Symbol("ALL"));
message.addGroup(group1);
try
{
Session.sendToTarget(message);
System.out.println("message" + message);
}catch (Exception ex)
{
System.out.println("error" + ex);
}
}
public void onLogout(SessionID sessionID) {
// TODO Auto-generated method stub
System.out.println("Successfully logged out for sessionId : " + sessionID);
}
public void toAdmin(quickfix.Message message, SessionID sessionID) {
// TODO Auto-generated method stub
if (message instanceof quickfix.fix42.Logon) {
try {
System.out.println(" Login " + SenderCompID + " " +
TargetCompID);
message.setString(quickfix.field.SenderCompID.FIELD,
SenderCompID);
message.setString(quickfix.field.TargetCompID.FIELD,
TargetCompID);
System.out.println(" Logon " + message.toString());
}
catch (Exception ex) {
throw new RuntimeException();
}
}else if (message instanceof quickfix.fix42.MarketDataRequest) {
System.out.println(" Sent Market Data Request ");
}
}
public void toApp(quickfix.Message message, SessionID sessionID) throws
DoNotSend {
// TODO Auto-generated method stub
System.out.println("Message : " + message + " for sessionid : " +
sessionID);
}
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();
String serverIp = props.getProperty("SocketConnectHost");
String serverPort = props.getProperty("SocketConnectPort");
System.out.println(" Data Server IP " + serverIp);
System.out.println(" Data Server Port " + serverPort);
// root.setLevel(Level.DEBUG);
while (sessionID == null) {
Thread.sleep(1000);
}
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
public void run() {
System.out.print("Logout");
Session.lookupSession(sessionID).logout();
}
}));
}catch (Exception e){
e.printStackTrace();
}
}
public void MarketDataIncrementalRefresh (Message message, SessionID
sessionID) throws FieldNotFound{
try
{
MDReqID mdreqid = new MDReqID();
SendingTime sendingtime = new SendingTime();
NoMDEntries nomdentries = new NoMDEntries();
quickfix.fix42.MarketDataIncrementalRefresh.NoMDEntries group
= new
quickfix.fix42.MarketDataIncrementalRefresh.NoMDEntries();
MDUpdateAction mdupdateaction = new MDUpdateAction();
DeleteReason deletereason = new DeleteReason();
MDEntryType mdentrytype = new MDEntryType();
MDEntryID mdentryid = new MDEntryID();
Symbol symbol = new Symbol();
MDEntryOriginator mdentryoriginator = new
MDEntryOriginator();
MDEntryPx mdentrypx = new MDEntryPx();
Currency currency = new Currency();
MDEntrySize mdentrysize = new MDEntrySize();
ExpireDate expiredate = new ExpireDate();
ExpireTime expiretime = new ExpireTime();
NumberOfOrders numberoforders = new NumberOfOrders();
MDEntryPositionNo mdentrypositionno = new
MDEntryPositionNo();
message.getField(nomdentries);
message.getField(sendingtime);
message.getGroup(1, group);
int list = nomdentries.getValue();
for (int i = 0; i < list; i++)
{
message.getGroup(i + 1, group);
group.get(mdupdateaction);
if (mdupdateaction.getValue() == '2')
System.out.println("Enter");
group.get(deletereason);
group.get(mdentrytype);
group.get(mdentryid);
group.get(symbol);
group.get(mdentryoriginator);
if (mdupdateaction.getValue() == '0')
group.get(mdentrypx);
group.get(currency);
if (mdupdateaction.getValue() == '0')
group.get(mdentrysize);
}
System.out.printf("Got Symbol {0} Price {1}",
symbol.getValue(), mdentrypx.getValue());
}catch (Exception ex)
{
System.out.println("error" + ex);
}
}
public void MarketDataSnapshotFullRefresh (Message message, SessionID
sessionID) throws FieldNotFound{
String Symbol = message.getField(new Symbol()).getValue();
NoMDEntries noMDEntries = new NoMDEntries();
message.getField(noMDEntries);
quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries group =
new quickfix.fix42.MarketDataSnapshotFullRefresh.NoMDEntries();
MDEntryType MDEntryType = new MDEntryType();
MDEntryPx MDEntryPx = new MDEntryPx();
MDEntrySize MDEntrySize = new MDEntrySize();
SendingTime sendingTime = new SendingTime();
message.getField(sendingTime);
message.getGroup(1, group);
group.get(MDEntryType);
group.get(MDEntryPx);
group.get(MDEntrySize);
message.getGroup(2, group);
group.get(MDEntryType);
group.get(MDEntryPx);
group.get(MDEntrySize);
System.out.printf("Symbol {0} Price {1}", Symbol, MDEntryPx);
}
public static void main(String[] args){
String configFile = args[0];
new TestMarketdataRequest(configFile);
}
}
so what is problem in my code ? i have add all of depedency with must
include in fix application using quickfixj engine. please help me for fix
it.
best regards,
fuad
Pada tanggal Sen, 30 Mar 2020 pukul 19.45 Fuad Azhar <fua...@gm...>
menulis:
> 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
>>>
>>
>>
|