Found the issue. 1. The account to be used to create application and generare token must be created from http://www.esri.com/software/arcgis/arcgisonline/evaluate. Click on "Create a NEW Esri Account" button. 2. The outspatialreference to be set to 102100 everywhere. Following is the modification required. // Create the stop points from point geometry StopGraphic startPnt = new StopGraphic(GeometryEngine.project(startPoint, SpatialReference.create(4326), SpatialReference.create(102100))); StopGraphic endPnt = new StopGraphic(GeometryEngine.project(endPoint, SpatialReference.create(4326), SpatialReference.create(102100)));
// set features on routing feature class naFeatures.setFeatures(new Graphic[] { startPnt, endPnt }); naFeatures.setSpatialReference(SpatialReference.create(102100)); routeParams.setOutSpatialReference(SpatialReference.create(102100));