cancel
Showing results for 
Search instead for 
Did you mean: 

QueryVariableValue error

bwolin
Champ in-the-making
Champ in-the-making
My company is doing an evaluation of Activiti with Grails and I'm getting an error trying to query tasks based on process variables.

I'm trying to get tasks associated with a specific company. I created the process and passed in a map with an integer in it for companyID.

I can see the variables for my process instance and the variable's type is shown to be java.lang.Integer, but I get an exception that my variable is of type ByteArray. Error shown below:


groovy:000> runtimeService.getVariables('28')
===> {documentID=null, companyID=51613, initiator=mwalker, personID=4132522       }
groovy:000> runtimeService.getVariables('28').companyID.class
===> class java.lang.Integer
groovy:000> taskService.createTaskQuery().processVariableValueEquals("companyID", 51613).list()
ERROR org.activiti.engine.ActivitiIllegalArgumentException:
Variables of type ByteArray cannot be used to query
        at org.activiti.engine.impl.QueryVariableValue.initialize (QueryVariableValue.java:52)
        at org.activiti.engine.impl.TaskQueryImpl.ensureVariablesInitialized (TaskQueryImpl.java:416)
        at org.activiti.engine.impl.TaskQueryImpl.executeList (TaskQueryImpl.java:461)
        at org.activiti.engine.impl.AbstractQuery.execute (AbstractQuery.java:139)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute (CommandExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute (CommandContextInterceptor.java:61)
        at org.activiti.spring.SpringTransactionInterceptor$1.doInTransaction (SpringTransactionInterceptor.java:42)
        at org.activiti.spring.SpringTransactionInterceptor.execute (SpringTransactionInterceptor.java:40)
        at org.activiti.engine.impl.interceptor.LogInterceptor.execute (LogInterceptor.java:31)
        at org.activiti.engine.impl.AbstractQuery.list (AbstractQuery.java:113)
        at groovysh_evaluate.run (groovysh_evaluate:2)
        …


Any idea what the problem is or what I'm doing wrong?

Thanks for any help on this!
5 REPLIES 5

bwolin
Champ in-the-making
Champ in-the-making
I should add this is using Postgres 9.1 as the backing database

bwolin
Champ in-the-making
Champ in-the-making
It appears the issue is that the Grails Activiti plugin adds it's own SerializableVariableType at the front of the VariableTypes list. Since that has an isAbleToStore(Object) method that returns true for anything implementing Serializable, it's storing everything as a byte array.

<code>
           // Define custom serializable types for fix issue with serialization
           customPreVariableTypes = [new SerializableVariableType()]
</code>

This seems like an obvious issue. Am I the first to report this issue because the Grails community is small?

I'll try to engage the plugin developer, but I'm growing concerned about the maturity of the implementation here. Feedback appreciated.

Thanks

jbarrez
Star Contributor
Star Contributor
The plugin author was very active a while ago, but we haven't seen him anymore since quite some time … (hopefully he now stands up and corrects me).

So yes, I wouldn't think the grails plugin it up par with the current release of Activiti.

bwolin
Champ in-the-making
Champ in-the-making
Thanks for the response. I've got a local build of the plugin that resolves this issue as well as upgrades it to 5.12. I'll offer it as a pull request and hopefully it will get released to others that way.

jbarrez
Star Contributor
Star Contributor
Ok, that would be very neat!