AnsweredAssumed Answered

IdentityService.saveUser requires more than declared User

Question asked by tstephen on Mar 21, 2011
Latest reply on Mar 22, 2011 by tstephen
The IdentityService declares

  void saveUser(User user)
but when I extended one of my existing classes to provide the expected User interface and passed it in I received the ClassCastException below. I realise that creating a User object with IdentityService.newUser is the expected usage but it would be nice to avoid copying the data from my user object to the Activiti user object. At least if this is necessary it would be good to declare a public class that must be passed into the saveUser method. 

I am using Activiti 5.3. The attached classes can drop into the 5.3 activiti-engine-examples to illustrate the problem.


java.lang.ClassCastException: org.activiti.examples.bpmn.servicetask.UserInfo cannot be cast to org.activiti.engine.impl.identity.UserEntity
   at org.activiti.engine.impl.cmd.SaveUserCmd.<init>(
   at org.activiti.engine.impl.IdentityServiceImpl.saveUser(
   at org.activiti.examples.bpmn.servicetask.IdentityTask.execute(
   at org.activiti.examples.bpmn.servicetask.IdentityTaskTest.testCreateUser(
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(
   at java.lang.reflect.Method.invoke(
   at junit.framework.TestCase.runTest(
   at junit.framework.TestCase.runBare(
   at junit.framework.TestResult$1.protect(
   at junit.framework.TestResult.runProtected(
   at junit.framework.TestSuite.runTest(
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(