8 Replies Latest reply on Mar 16, 2006 3:08 AM by Administrator Administrator

    Seems I found a bug

    Alexey Kakunin Newbie

      First of all - this is my first post here, so, hello to everybody and thank you JBoss for very good job - jBPM seems to be really very powerfull solution.

      But seems I found a bug - I cannot get Comment from the token - then I try to make any action with comments collection like:

      m_tokem.getComments().size()
      

      I've got error:
      org.hibernate.HibernateException: null index column for collection: org.jbpm.graph.exe.Token.comments
       org.hibernate.persister.collection.AbstractCollectionPersister.readIndex(AbstractCollectionPersister.java:652)
       org.hibernate.collection.PersistentList.readFrom(PersistentList.java:358)
       org.hibernate.loader.Loader.readCollectionElement(Loader.java:994)
       org.hibernate.loader.Loader.readCollectionElements(Loader.java:635)
       org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
       org.hibernate.loader.Loader.doQuery(Loader.java:689)
       org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
       org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
       org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:71)
       org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:520)
       org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
       org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1627)
       org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:344)
       org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
       org.hibernate.collection.AbstractPersistentCollection.readSize(AbstractPersistentCollection.java:109)
       org.hibernate.collection.PersistentList.size(PersistentList.java:91)
       ru.emdev.ProcessManager.bean.TaskBean.getHasComments(TaskBean.java:208)
       sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
       sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
       java.lang.reflect.Method.invoke(Unknown Source)
       org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:314)
       org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)
       org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:263)
       org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorImpl.java:190)
       org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:922)
       org.apache.jsp.task_jsp._jspx_meth_c_if_3(org.apache.jsp.task_jsp:436)
       org.apache.jsp.task_jsp._jspService(org.apache.jsp.task_jsp:137)
       org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
       org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
       org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
       javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       ru.emdev.ProcessManager.filter.AuthenticationFilter.doFilter(AuthenticationFilter.java:41)
       org.jbpm.web.JbpmContextFilter.doFilter(JbpmContextFilter.java:83)
       org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81
      


      Comments for task instances works quite well.


      Is it really bug and should I register it somethere?

        • 1. Re: Seems I found a bug
          Alexey Kakunin Newbie

          I forgot to add:
          I'm using last public stable jBPM (3.1) with JBoss 4.0.3-SP1 & PostgreSQL 8.1 under WinXP SP2

          • 2. Re: Seems I found a bug
            Koen Aers Master

            I have inspected the hibernate mapping file and could not find any potential problem. Are you sure the tables in your PostgreSQL are correctly created? If yes, try to reproduce the problem with HSQLDB in a JUnit test.

            Regards,
            Koen

            • 4. Re: Seems I found a bug
              Alexey Kakunin Newbie

              OK, we found why I've got this error, by some reasons, they I add comment for the task, record are written into bpm_comment table, and by some reasons, I do not found why, it put information into token_, taskinstance_ and taskinstanceindex_, but kept tokenindex_ field empty.

              As result then I'm trying to get list of comments for token I've got error.

              As result I've got this error.
              The problem is what we cannot resproduce this bug in test - in tests (with same configuration) everything work well.

              This bug appears only in our web-application.

              Seems, it is related to hibernate... but we have not very good experience in hibernate internals.

              Does anybody have any idea where it is possible to look for problem?

              • 5. We found it!
                Alexey Kakunin Newbie

                We found it!
                Wow, but it about one working day and makes us creazy :)

                So, here is a part of org.jboss.jbpm.taskmgmt.exe.TaskInstance.java vfor working with comment:

                public void addComment(String message) {
                 Comment comment = new Comment(message);
                 addComment(comment);
                 if (token!=null) {
                 token.addComment(comment);
                 }
                 }
                
                 public void addComment(Comment comment) {
                 if (comments==null) comments = new ArrayList();
                 comments.add(comment);
                 comment.setTaskInstance(this);
                 comment.setToken(token);
                 }
                


                In TestCase we added comment as string and this method after adding comment into own collection, also adds comment into Token's collection.

                But in our web-application we added comment as Comment class (used second method) - and as result this comment was not added into Token's comments and as result field tokenindex_ in jbpm_comment table was empty.

                I think code
                 if (token!=null) {
                 token.addComment(comment);
                 }
                


                should be moved from method TokenInstance::addComment(String comment) to method TokenInstance::addComment(Comment comment)

                Since we have to development access to jbpm repository could someone who has to do it?

                Thank you!

                • 6. Re: Seems I found a bug
                  Koen Aers Master

                  Alexey,

                  Please post a JIRA bug report (http://jira.jboss.com) and provide a link to this forum thread. Make sure you specify the affected jBPM release.

                  Regards,
                  Koen

                  • 8. Re: Seems I found a bug
                    Administrator Administrator Novice

                    thanks for reporting in such a detailed fashion. that helps us to include your fix quickly.

                    it's fixed in the next versions of 3.1 and 3.2+

                    regards, tom.