Java Service fails when invoked from taskj rule

I have a java Service that throws the following error when called from a business task rule:

2011-01-16 12:16:39 CST [PRT.0101.0376E] Error invoking step POSTTDE_S13, PID=1fa4de5f-7c4b-41a2-b1f5-90f56fca6024:1 (TramitesPension.AltaPago.AltaPago_1.Default:AP_Confirmar_Pago_OutputMapService): [PRT.0101.9432] Task execution was unsuccessful. The task engine returned status: error and error message: Unhandled Exception during rule processing. Rule [/meta/default/wm_xt_portalrules/0000009917] com.webmethods.caf.rules.RuleException: com.webmethods.caf.common.CommonException: Unable to convert data type “java.lang.Object” to “java.util.Date”
at com.webmethods.caf.rules.impl.comparator.AssignmentComparator.evaluateBoolean(AssignmentComparator.java:76)
at com.webmethods.caf.rules.impl.logicalOp.BaseLogicalOp.evaluate(BaseLogicalOp.java:28)
at com.webmethods.caf.rules.impl.logicalOp.SemiColonLogicalOp.evaluate(SemiColonLogicalOp.java:44)
at com.webmethods.caf.rules.impl.logicalOp.SemiColonLogicalOp.evaluate(SemiColonLogicalOp.java:44)
at com.webmethods.caf.rules.impl.logicalOp.SemiColonLogicalOp.evaluate(SemiColonLogicalOp.java:44)
at com.webmethods.caf.rules.impl.Rule.evaluateResult(Rule.java:65)
at com.webmethods.portal.mech.task.impl.TaskRuleHelper.evaluateRule(TaskRuleHelper.java:111)
at com.webmethods.portal.mech.task.impl.TaskChangeHandler.evaluateTriggerRule(TaskChangeHandler.java:689)
at com.webmethods.portal.mech.task.impl.TaskChangeHandler.processTriggerRulesInFolder(TaskChangeHandler.java:701)
at com.webmethods.portal.mech.task.impl.TaskChangeHandler.processTaskChangedEvent(TaskChangeHandler.java:591)
at com.webmethods.portal.mech.task.impl.TaskChangeHandler$2.run(TaskChangeHandler.java:308)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: com.webmethods.caf.common.CommonException: Unable to convert data type “java.lang.Object” to “java.util.Date”
at com.webmethods.caf.common.ObjectUtil.convertToType(ObjectUtil.java:381)
at com.webmethods.caf.common.ObjectUtil.convertToType(ObjectUtil.java:58)
at com.webmethods.caf.rules.impl.comparator.AssignmentComparator.evaluateBoolean(AssignmentComparator.java:70)
… 16 more

The java service receives 1 object and 1 string and returns one object. When run in developer it runs ok. This is the code

IDataCursor idcPipeline = pipeline.getCursor();
try {
Date fecha = new Date();
String nroDias;
int nroDiasInt;

if (idcPipeline.first(“nroDias”)) {
nroDias = (String) idcPipeline.getValue();
}else {
throw new ServiceException(“Bad Parameter.”);
}

Date fechaIncDias;
Calendar fechaCal = Calendar.getInstance();

int dias = fechaCal.get(Calendar.DAY_OF_MONTH);
nroDiasInt = Integer.parseInt(nroDias);
dias = dias + nroDiasInt;
fechaCal.set(Calendar.DAY_OF_MONTH, dias);
fechaCal.set(Calendar.HOUR_OF_DAY, 0);
fechaCal.set(Calendar.MINUTE, 0);
fechaCal.set(Calendar.SECOND, 0);

fechaIncDias = fechaCal.getTime();

idcPipeline.insertAfter(“fechaResult”, fechaIncDias);
}catch (Exception e) {
throw new ServiceException(e.getMessage());
}

idcPipeline.destroy();

What could be happening?

Thx,

Guys, it’s solved. Basically I set the Java wrapper type of the output to java.util.Date in Developer.