Search code examples
javaquickfixfix-protocolquickfixj

Implementing a FIX client through QuickFixJ throws NoSuchMethodError


I am relatively new to FIX and this is my first time trying to connect. I am attempting to use the QuickFixJ library to connect to a UAT environment I have been provided with. Specifically I am using quickfixj-all-1.6.0.jar

I have implemented the sample code from here and it works up until socketAcceptor.start().

Here is the full code sample:

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();
   }

The error i am getting is

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)

The "SenderCompID->TargetCompID" variables are provided but have been removed from the sample here.

quickfix.mina.message.FIXProtocolCodecFactory.addMessageDecoder(Ljava/lang/Class;)V Is thrown within the socketAcceptor.start method. I cant see any cause for this as i have only changed the config examples to point towards the FIX UAT environment

I cannot understand why a method contained in the jar will throw this error, I am not trying to send a message at this stage only trying to open a connection. The example seems to have worked for others.

I get the exact same error using the FIX Client example found here as well


Solution

  • Importing the second example as-is instead of trying to implement into my own Eclipse project worked. The problem appears to have been caused by using an incorrect import from the quickfix-all jar causing the wrong method to be called during start up.