cancel
Showing results for 
Search instead for 
Did you mean: 

java.util.Date cannot be cast to java.lang.Long

tomi87
Champ in-the-making
Champ in-the-making
Hello,
I get an error message after I deploy my file to the activiti explorer.
I get the following message:

com.vaadin.event.ListenerMethod$MethodException
Cause: com.vaadin.event.ListenerMethod$MethodException
Cause: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Long
   at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
   at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
   at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1193)
   at com.vaadin.ui.Button.fireClick(Button.java:539)
   at com.vaadin.ui.Button.changeVariables(Button.java:206)
   at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1299)
   at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1219)
   at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:735)
   at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
   at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
   at java.lang.Thread.run(Thread.java:722)
Caused by: com.vaadin.event.ListenerMethod$MethodException
Cause: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Long
   at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
   at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
   at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1193)
   at org.activiti.explorer.ui.form.FormPropertiesForm.access$000(FormPropertiesForm.java:45)
   at org.activiti.explorer.ui.form.FormPropertiesForm$1.buttonClick(FormPropertiesForm.java:139)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke(Method.java:601)
   at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)
   … 22 more
Caused by: java.lang.ClassCastException: java.util.Date cannot be cast to java.lang.Long
   at org.process1.CreateStudentApp.execute(CreateStudentApp.java:16)
   at org.activiti.engine.impl.delegate.JavaDelegateInvocation.invoke(JavaDelegateInvocation.java:34)
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:49)
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskJavaDelegateActivityBehavior.execute(ServiceTaskJavaDelegateActivityBehavior.java:40)
   at org.activiti.engine.impl.bpmn.helper.ClassDelegate.execute(ClassDelegate.java:115)
   at org.activiti.engine.impl.pvm.runtime.AtomicOperationActivityExecute.execute(AtomicOperationActivityExecute.java:44)
   at org.activiti.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:80)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:546)
   at org.activiti.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:541)

I have this both date's in the startEvent in the bpmn20.xml file:
<activiti:formProperty id="dateFrom" name="Date from (dd-MM-yyyy)" required="true" datePattern="dd-MM-yyyy" type="date" />  
<activiti:formProperty id="dateTo" name="Date to (dd-MM-yyyy)" required="true" datePattern="dd-MM-yyyy" type="date" />
the next task is a serviceTask which call the activiti:class="org.process1.CreateStudentApp"
      
The first error tell me:
cvc-complex-type.3.2.2: Attribute 'datePattern' is not allowed to appear in element 'activiti:formProperty'.

Ok then my CreateStudentApp class:
package org.process1;
import java.util.Date;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

public class CreateStudentApp implements JavaDelegate {
   public void execute(DelegateExecution execution) {
      StudentAppInfo sai = new StudentAppInfo();
      sai.setDateFrom((Date) execution.getVariable("dateFrom"));
      sai.setDateTo((Date) execution.getVariable("dateTo"));
      execution.setVariable("studentAppInfo", sai);}}
and my StudentAppInfo class:

   
private String dateFrom;
public void setDateFrom(Date dateFrom) {
      DateFormType dft = new DateFormType("dd-MM-yyyy");
      this.dateFrom = dft.convertModelValueToFormValue(dateFrom);
   }

I searched in some other forums, but I coudn't find a solution for my problem.
I can't see what I did wrong in my code. Please help me.
Regards Thomas
4 REPLIES 4

trademak
Star Contributor
Star Contributor
Hi Thomas,

This looks okay at first sight.
Can you create a unit test project that shows this error?
You can sent it to tijs.rademakers At gmail.com

Best regards,

mmaker1234
Champ in-the-making
Champ in-the-making
Hello Thomas,

Which version of the workflow engine, and which flavor and version of the process definition editor you are using?

tomi87
Champ in-the-making
Champ in-the-making
Hello Thomas,

Which version of the workflow engine, and which flavor and version of the process definition editor you are using?


How and where can I figure it out ?

activiti-5.10
org.eclipse.platformversion=3.7.0

tomi87
Champ in-the-making
Champ in-the-making
Hi Thomas,

This looks okay at first sight.
Can you create a unit test project that shows this error?
You can sent it to tijs.rademakers At gmail.com

Best regards,

When I create a normal Junit test, it told me, that everythink is ok.
I send you a .zip
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.