3 Replies Latest reply on Oct 13, 2011 2:59 PM by Kiran A

    Errors in Task Queries

    Kiran A Newbie

      I am using the JBM5 5.2.0-SNAPSHOT with Hibernate 3.6.0.Final. My pom is pretty standard with required dependencies (jbpm-human-task,

      jbpm-persistence-jpa, etc)

       

       

      My persistence.xml and orm.xml resemble -

      https://github.com/Salaboy/emergency-service-drools-app/tree/master/emergency-service-core/src/main/resources/META-INF/orm.xml

      https://github.com/Salaboy/emergency-service-drools-app/tree/master/emergency-service-core/src/main/resources/META-INF/persistence.xml

       

      Starting the HumanTaskService however is throwing exceptions for the TaskSummary. Is anyone else facing similar problems ?

       

       

       

      ERROR [HumanTaskService.main()] PARSER.reportError(56) |  Unable to locate appropriate constructor on class [org.jbpm.task.query.TaskSummary]

      [cause=org.hibernate.PropertyNotFoundException: no appropriate constructor in class: org.jbpm.task.query.TaskSummary]

      ERROR [gov.nc.osbm.ibis.HumanTaskService.main()] SessionFactoryImpl.<init>(422) | Error in named query: TasksOwned

      org.hibernate.hql.ast.QuerySyntaxException: Unable to locate appropriate constructor on class [org.jbpm.task.query.TaskSummary] [select new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, names.text, subjects.text, descriptions.text, t.taskData.status, t.priority, t.taskData.skipable, t.taskData.actualOwner, t.taskData.createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime) from org.jbpm.task.Task t left join t.taskData.createdBy, org.jbpm.task.I18NText names, org.jbpm.task.I18NText subjects, org.jbpm.task.I18NText descriptions where t.taskData.actualOwner.id = :userId and names in elements( t.names) and names.language = :language and ( subjects.language = :language and subjects in elements( t.subjects) or t.subjects.size = 0 ) and ( descriptions.language = :language and descriptions in elements( t.descriptions) or t.descriptions.size = 0 ) and t.taskData.expirationTime is null]

                at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)

                at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)

                at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:82)

                at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:261)

                at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)

                at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)

                at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)

                at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)

                at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)

                at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:547)

                at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:411)

                at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)

                at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:902)

                at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:74)

                at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)

                at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)

                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)

                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)

                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)

                at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:563)

                at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)

                at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)

                at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)

                at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)

                at gov.nc.osbm.ibis.HumanTaskService.main(HumanTaskService.java:88)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:291)

                at java.lang.Thread.run(Thread.java:680)

        • 1. Re: Errors in Task Queries
          Kiran A Newbie

          Wondering if there are any suggestions. I have checked the TaskSummary source and the constructor looks fine. Most of the other queries (TasksAssignedAsPotentialOwner, TasksAssignedAsPotentialOwnerByGroup, GetSubTasksByParentTaskId, TasksAssignedAsRecipient, TasksAssignedAsTaskInitiator)

          in the orm.xml also fail. Clearly I am missing something. Any pointers would be useful

          • 2. Re: Errors in Task Queries
            Demian Calcaprina Master

            Hi Kiram, if you see at the error, it the task summary object is constructed like this:

            new org.jbpm.task.query.TaskSummary( t.id, t.taskData.processInstanceId, names.text, subjects.text, descriptions.text, t.taskData.status, t.priority, t.taskData.skipable, t.taskData.actualOwner, t.taskData.createdBy, t.taskData.createdOn, t.taskData.activationTime, t.taskData.expirationTime)

             

            In emergency services orm file you mentioned, the same query, TasksOwned, has this:

            new org.jbpm.task.query.TaskSummary(

                t.id,

                t.taskData.processInstanceId,

                name.text,

                subject.text,

                description.text,

                t.taskData.status,

                t.priority,

                t.taskData.skipable,

                t.taskData.actualOwner,

                t.taskData.createdBy,

                t.taskData.createdOn,

                t.taskData.activationTime,

                t.taskData.expirationTime,

                t.taskData.processId,

                t.taskData.processSessionId)

             

            It seems you have your orm.xml outdated, or other old orm.xml in your classpath?

             

            Regards,

             

            Demian

            • 3. Re: Errors in Task Queries
              Kiran A Newbie

              Indeed ! I had an older orm.xml !  I had to make another another change for JPA 2.0

               

              <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_2_0.xsd" version="2.0">

               

              Else there was an error on console:


              ErrorLogger.error(57) | Error parsing XML (3) : cvc-complex-type.3.1: Value '1.0' of attribute 'version' of element 'entity-mappings' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '2.0'.

               

              Thanks !