Search code examples
javaquickfixfix-protocolquickfixj

apache.servicemix.bundles.quickfix - Attempting to create standalone NewOrderSingle object throws exception


I am attempting to write a class for converting domain POJO's into QuickFixJ messages. When I try to create a new order message as so:

quickfix.fix44.NewOrderSingle order = new quickfix.fix44.NewOrderSingle();

The following exception is thrown in the logs:

Exception Details:
Location:
  quickfix/fix44/NewOrderSingle.get(Lquickfix/field/SettlType;)Lquickfix/field/SettlType; @2: invokevirtual
Reason:
Type 'quickfix/field/SettlType' (current frame, stack[1]) is not assignable to 'quickfix/CharField'
Current Frame:
  bci: @2
  flags: { }
  locals: { 'quickfix/fix44/NewOrderSingle', 'quickfix/field/SettlType' }
  stack: { 'quickfix/fix44/NewOrderSingle', 'quickfix/field/SettlType' }
Bytecode:
  0000000: 2a2b b600 3057 2bb0                    

It seems this error happens when attempting to merge two versions of Fix Message Fields together but as far as I know I am not doing this. I am using the same code as found in the QuickFixJ unit tests A variation of the same code works in this example, it is after a connection is applied through the initiator object. I am using the apache.servicemix.bundles.quickfix instead of the QuickFix-all.jar because it contains some fields i need to add to other messages.

I am unsure why I am not able to call a simple constructor of an object. The constructor in the jar is as follows:

public NewOrderSingle()
{
   getHeader().setField(new MsgType("D"));
}

Is there another possible cause for this error I havent thought of? I am stumped


Solution

  • I had this problem and had to revert to QuickFIX 1.5.2

    quickfixj message factory produces bad type on operand stack using qf 1.6.0 and java 1.8.0_45

    It's a known issue according to the user group. See the attached question...