Appium scrolling with TouchAction

I am using the below code for scrolling:

TouchAction action = new TouchAction((MobileDriver) driver.getWebDriver());, starty)).waitAction(WaitOptions.waitOptions(Duration.ofMillis(50))).moveTo(PointOption.point(startx, endy)).release().perform();

There is no error from eclipse but during execution I am getting error as “java.lang.ClassCastException: java.lang.NoSuchMethodError cannot be cast to java.lang.Exception” at the first line itself. It did not execute the second line. Please help.

Appium version: 1.10.0
Java Client: 6.1.0