While adding the step element into the TransMeta getting some error related to thread and the XML is not generating and also adding the DB details also creating problem .Below is my code to add the Step.

TransMeta transMeta = new TransMeta(templname,templname);
transMeta.setName("Testing");

LOGGER.info("transMeta----->"+transMeta);

DatabaseMeta dbmeta = new DatabaseMeta();
LOGGER.info("dbmeta----->"+dbmeta);
dbmeta.setName("MS_SQL");
dbmeta.setHostname("172.25.164.63");
dbmeta.setDBPort("1433");
dbmeta.setDBName("DM_MetaData");
dbmeta.setUsername("sa");
dbmeta.setPassword("Password123");
@SuppressWarnings("deprecation")
Database db = new Database(dbmeta);

//Add Step Source
StepMeta inputStep = new StepMeta();
inputStep.setName("source");
inputStep.setDistributes(true);
inputStep.setCopies(1);
StepPartitioningMeta stepPartMeta = new StepPartitioningMeta();
stepPartMeta.setMethod("none");
inputStep.setStepPartitioningMeta(stepPartMeta);
LOGGER.info("inputStep----->"+inputStep);
transMeta.addStep(inputStep);

//Generated XML from Java Code
String filepath = "D:\\Pentaho\\output\\"+templname+".xml";


transMeta.writeXML(filepath);
return filepath;


Please suggest if i am wrong.

Thanks,
Satya