|
From: Fuadazhar73 <fua...@gm...> - 2020-03-30 03:56:05
|
Good Morning All of member quickFixj i am new here for quickfixj.
i have quickfixj project for market data request. but when i try to run my
application there is error about [ec2-user fastmatch_server_new]$ java -jar
fastmatchmarketdata-0.0.1-SNAPSHOT.jar
Error: A JNI error has occurred, please check your installation and try
again
Exception in thread "main" java.lang.NoClassDefFoundError:
quickfix/SessionNotFound
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at
sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at
sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: quickfix.SessionNotFound
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)
... 7 more
this is my main class for this application
package com.dxtr.marketdatarequest.fastmatchmarketdata;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.UUID;
import quickfix.Initiator;
import quickfix.*;
import quickfix.fix42.*;
import quickfix.LogFactory;
import quickfix.Application;
import quickfix.ConfigError;
import quickfix.DefaultMessageFactory;
import quickfix.FileLogFactory;
import quickfix.FileStoreFactory;
import quickfix.Message.Header;
import quickfix.MessageFactory;
import quickfix.Session;
import quickfix.SessionID;
import quickfix.SessionNotFound;
import quickfix.SessionSettings;
import quickfix.SocketInitiator;
import quickfix.field.BeginString;
import quickfix.field.HeartBtInt;
import quickfix.field.MDEntryType;
import quickfix.field.MDReqID;
import quickfix.field.MarketDepth;
import quickfix.field.MsgType;
import quickfix.field.NoMDEntryTypes;
import quickfix.field.ResetSeqNumFlag;
import quickfix.field.SenderCompID;
import quickfix.field.SubscriptionRequestType;
import quickfix.field.Symbol;
import quickfix.field.TargetCompID;
import quickfix.fix42.Message;
public class FastmatchMDRequest {
public static void main(String[] args) {
SocketInitiator socketInitiator = null;
try {
SessionSettings sessionSettings = new
SessionSettings("/home/ec2-user/fastmatch_server_new/FIXQuote2.cfg");
Application application = new TestMarketdataRequest();
FileStoreFactory fileStoreFactory = new
FileStoreFactory(sessionSettings);
FileLogFactory logFactory = new FileLogFactory(sessionSettings);
MessageFactory messageFactory = new DefaultMessageFactory();
socketInitiator = new SocketInitiator(application,
fileStoreFactory, sessionSettings, logFactory,
messageFactory);
socketInitiator.start();
SessionID sessionId = socketInitiator.getSessions().get(0);
sendMarkeDataRequest(sessionId);
int i = 0;
do {
try {
Thread.sleep(1000);
System.out.println(socketInitiator.isLoggedOn());
} catch (InterruptedException e) {
e.printStackTrace();
}
i++;
} while ((!socketInitiator.isLoggedOn()) && (i < 30));
} catch (ConfigError e) {
e.printStackTrace();
} catch (SessionNotFound e) {
e.printStackTrace();
} catch (Exception exp) {
exp.printStackTrace();
} finally {
if (socketInitiator != null) {
socketInitiator.stop(true);
}
}
}
private static void sendMarkeDataRequest(SessionID sessionId)
throws SessionNotFound {
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);
}
}
}
and this is my application for quickfixj
package com.dxtr.marketdatarequest.fastmatchmarketdata;
import quickfix.*;
import quickfix.Message.Header;
import quickfix.field.*;
import quickfix.fix42.*;
import quickfix.fix42.Message;
import quickfix.MessageFactory;
public class TestMarketdataRequest implements Application {
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 {
// TODO Auto-generated method stub
System.out.println("Successfully called fromApp for sessionId : "
+ message);
}
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
System.out.println("Successfully logged on for sessionId : " + sessionID);
}
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
System.out.println("Inside toAdmin");
}
public void toApp(quickfix.Message message, SessionID sessionID) throws
DoNotSend {
// TODO Auto-generated method stub
System.out.println("Message : " + message + " for sessionid : " +
sessionID);
}
public void onMessage(MarketDataIncrementalRefresh message, SessionID
sessionID)
throws FieldNotFound, UnsupportedMessageType, IncorrectTagValue
{
System.out.println("Inside onMessage for New Order Single" + message
+ sessionID);
}
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);
}
}
so how to fix my problem ? please help me for fix my problem. your help very
appreciate
best regards,
Fuad
--
Sent from: http://quickfix-j.364392.n2.nabble.com/
|