我对 FIX 比较陌生,这是我第一次尝试连接。我正在尝试使用 QuickFixJ 库连接到我提供的 UAT 环境。具体来说,我正在使用 quickfixj-all-1.6.0.jar
我已经从这里实现了示例代码,它一直工作到socketAcceptor.start()
.
这是完整的代码示例:
SocketAcceptor socketAcceptor = null;
try {
SessionSettings executorSettings = new SessionSettings(
"quickFixTester/acceptorSettings.txt");
Application application = new TestTradeAppExecutor();
FileStoreFactory fileStoreFactory = new FileStoreFactory(
executorSettings);
MessageFactory messageFactory = new DefaultMessageFactory();
FileLogFactory fileLogFactory = new FileLogFactory(executorSettings);
socketAcceptor = new SocketAcceptor(application, fileStoreFactory,
executorSettings, fileLogFactory, messageFactory);
socketAcceptor.start();
} catch (ConfigError e) {
e.printStackTrace();
}
我得到的错误是
2312 [main] INFO quickfix.SessionSchedule - [FIX.4.4:[SenderCompID]->[TargetCompID]] weekly, SUN 00:00:00-UTC - FRI 00:00:00-UTC
Executor Session Created with SessionID = FIX.4.4:[SenderCompID]->[TargetCompID]
2327 [main] INFO quickfix.SocketAcceptor - SessionTimer started
2371 [main] INFO quickfix.mina.NetworkingOptions - Socket option: SocketTcpNoDelay=true
2371 [main] INFO quickfix.mina.NetworkingOptions - Socket option: SocketSynchronousWrites=false
2371 [main] INFO quickfix.mina.NetworkingOptions - Socket option: SocketSynchronousWriteTimeout=30000
Exception in thread "main" java.lang.NoSuchMethodError: quickfix.mina.message.FIXProtocolCodecFactory.addMessageDecoder(Ljava/lang/Class;)V
at quickfix.mina.message.FIXProtocolCodecFactory.<init>(FIXProtocolCodecFactory.java:31)
at quickfix.mina.acceptor.AbstractSocketAcceptor.startAcceptingConnections(AbstractSocketAcceptor.java:109)
at quickfix.SocketAcceptor.initialize(SocketAcceptor.java:86)
at quickfix.SocketAcceptor.start(SocketAcceptor.java:80)
at quickFixTester.TestTradeAppExecutorApp.main(TestTradeAppExecutorApp.java:38)
提供了“SenderCompID->TargetCompID”变量,但已从此处的示例中删除。
quickfix.mina.message.FIXProtocolCodecFactory.addMessageDecoder(Ljava/lang/Class;)V 在 socketAcceptor.start 方法中抛出。我看不出有任何原因,因为我只更改了配置示例以指向 FIX UAT 环境
我不明白为什么 jar 中包含的方法会抛出这个错误,我不是在这个阶段试图发送消息,只是试图打开一个连接。这个例子似乎对其他人有用。
我也使用此处找到的 FIX 客户端示例得到了完全相同的错误