Optional long parameter is present but cannot be translated into a null value

I got this error when I was working with Jackson REST web services (RESTful Spring Controllers). The problem was that I forgot the @PathVariable annotation which tells the web service where it should receive your input to produce the response so it did not know where I should be passing my input. My fix was:

@RequestMapping(value = "/supplier/{supplierId}")
public List<PurchaseInvoice> getPurchaseInvoicesBySupplierId(@PathVariable int supplierId) {
    return purchaseInvoiceService.getPurchaseInvoicesBySupplierId(supplierId);
}

The error is pretty much self explanatory: you can't declare a primitive to be null,
for example: private int myNumber = null; will not compile. So instead of using long use Long and you should be good to go.