I set up a user defined java class that generates a row for each day within a certain timespan. If I test the class using "Test class" everything works as expected. However, when the step is actually called within the process I get the following error:

013/10/28 11:45:00 - Generate Dates.0 - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : Error initializing UserDefinedJavaClass:

2013/10/28 11:45:00 - Generate Dates.0 - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : org.codehaus.janino.CompileException

2013/10/28 11:45:00 - Generate Dates.0 - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : Error initializing step [Generate Dates]

2013/10/28 11:45:00 - Table output.0 - Connected to database [MSSQL Eric] (commit=1000)

2013/10/28 11:45:00 - Eingabe_Currencies - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : Step [Generate Dates.0] failed to initialize!

2013/10/28 11:45:00 - Spoon - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : Eingabe_Currencies: preparing transformation execution failed

2013/10/28 11:45:00 - Spoon - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : org.pentaho.di.core.exception.KettleException:

2013/10/28 11:45:00 - Spoon - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : We failed to initialize at least one step. Execution can not begin!

2013/10/28 11:45:00 - Spoon - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) :

2013/10/28 11:45:00 - Spoon - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) :

2013/10/28 11:45:00 - Spoon - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : at org.pentaho.di.trans.Trans.prepareExecution(Trans.java:932)

2013/10/28 11:45:00 - Spoon - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : at org.pentaho.di.ui.spoon.trans.TransGraph$22.run(TransGraph.java:3652)

2013/10/28 11:45:00 - Spoon - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : at java.lang.Thread.run(Thread.java:724)

2013/10/28 11:45:00 - Eingabe_Currencies - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : Errors detected!

2013/10/28 11:45:00 - Eingabe_Currencies - ERROR (version 4.4.0-stable, build 17588 from 2012-11-21 16.02.21 by buildguy) : Errors detected!

The code for the class looks like this: import java.util.Date; import java.util.Calendar; import java.text.SimpleDateFormat;

public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException

{

Object[] r = getRow();

if (r == null) {

setOutputDone();

return false;

}

Calendar calStart;

calStart = Calendar.getInstance();

calStart.set(Calendar.YEAR, 2013);

calStart.set(Calendar.MONTH, 0);

calStart.set(Calendar.DAY_OF_MONTH, 1);

Calendar calEnd;

calEnd = Calendar.getInstance();

SimpleDateFormat sdfDatum=new SimpleDateFormat("yyyy-MM-dd");

Calendar cal = Calendar.getInstance();

for(cal.setTime(calStart.getTime());cal.before(calEnd); cal.add(Calendar.DATE, 1))

{

r = createOutputRow(r, data.outputRowMeta.size());

try{

get(Fields.Out, "date").setValue(r, sdfDatum.format(cal.getTime()));}

catch(Exception e) {}

putRow(data.outputRowMeta, r);

}

setOutputDone();

return false;

}

Do you have any ideas on how to solve that problem?

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐