I have a simple pentaho formation with MongoDBInput connected with JSON Output. I am able to fetch json while i see preview in Pentaho Design studio but as I try to integrate with java, and run the transformation, its throwing error -
Exception in thread "main" org.pentaho.di.core.exception.KettleXMLException: Error reading object from XML file
Unable to load step info from XML step nodeorg.pentaho.di.core.exception.KettleStepLoaderException: Unable to load class for step/plugin with id [MongoDbInput]. Check if the plugin is available in the plugins subdirectory of the Kettle distribution.
Unable to load class for step/plugin with id [MongoDbInput]. Check if the plugin is available in the plugins subdirectory of the Kettle distribution.
My code is:
import java.io.IOException;
import java.util.List;
import org.pentaho.di.core.KettleEnvironment;
import org.pentaho.di.core.util.EnvUtil;
import org.pentaho.di.trans.TransMeta;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.core.*;
import org.pentaho.di.core.exception.*;
public class KettleConnector {
public static void main(String[] args) throws KettleException, IOException{
KettleEnvironment.init(false);
EnvUtil.environmentInit();
TransMeta transMeta = new TransMeta("D:\\mangoes.ktr");
Trans trans = new Trans(transMeta);
trans.execute(null); // You can pass arguments instead of null.
trans.waitUntilFinished();
Result r = trans.getResult();
List<RowMetaAndData> rowsResult = r.getRows();
System.out.println(trans.getTransMeta());
if (trans.getErrors() > 0) {
throw new RuntimeException();
}
}
}
It works fine for mysql transformations.
I have included mongo-2.4jar and mongo-java-driver-2.7.2.jar
still am facing this error.