Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-2201

Camunda engine-rest throws NoClassDefFoundError: org.joda.time.DateTime when attempting to use DueAfter/DueBefore filter on TaskService-TaskRequest-getTasks()

    • Icon: Bug Report Bug Report
    • Resolution: Fixed
    • Icon: L3 - Default L3 - Default
    • 7.2.0, 7.1.3, 7.2.0-alpha3
    • None
    • engine
    • None

      Getting NoClassDefFoundError in logs when running the following PHP code (using the Camunda PHP SDK):

      $taskService = new \org\camunda\php\sdk\service\TaskService('http://localhost:8080/engine-rest');
      $tr = new TaskRequest();
      $start = "2014-04-26T23-00-00";
      $tr->setDueAfter($start); /// works fine if this line is something other than a time-related field
      $tasks = $taskService->getTasks($tr);

      ------

      Camunda console output:

      15:55:16,184 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/engine-rest].[org.camunda.bpm.engine.rest.impl.application.DefaultApplication]] (http-/127.0.0.1:8080-4) JBWEB000236: Servlet.service() for servlet org.camunda.bpm.engine.rest.impl.application.DefaultApplication threw exception: org.jboss.resteasy.spi.UnhandledException: java.lang.NoClassDefFoundError: org/joda/time/DateTime
      at org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:208) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:55) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:50) [resteasy-jaxrs-2.3.5.Final.jar:]
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.2.Final.jar:1.0.2.Final]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:47) [classes:]
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:920) [jbossweb-7.2.0.Final.jar:7.2.0.Final]
      at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
      Caused by: java.lang.NoClassDefFoundError: org/joda/time/DateTime
      at org.camunda.bpm.engine.rest.dto.converter.DateConverter.convertQueryParameterToType(DateConverter.java:23) [classes:]
      at org.camunda.bpm.engine.rest.dto.converter.DateConverter.convertQueryParameterToType(DateConverter.java:19) [classes:]
      at org.camunda.bpm.engine.rest.dto.AbstractQueryDto.setValueBasedOnAnnotation(AbstractQueryDto.java:106) [classes:]
      at org.camunda.bpm.engine.rest.dto.AbstractQueryDto.<init>(AbstractQueryDto.java:63) [classes:]
      at org.camunda.bpm.engine.rest.dto.task.TaskQueryDto.<init>(TaskQueryDto.java:115) [classes:]
      at org.camunda.bpm.engine.rest.impl.TaskRestServiceImpl.getTasks(TaskRestServiceImpl.java:42) [classes:]
      at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source) [:1.7.0_51]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]
      at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
      at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:211) [resteasy-jaxrs-2.3.5.Final.jar:]
      at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) [resteasy-jaxrs-2.3.5.Final.jar:]
      ... 22 more
      Caused by: java.lang.ClassNotFoundException: org.joda.time.DateTime from [Module "deployment.camunda-engine-rest-7.1.0-Final.war:main" from Service Module Loader]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]
      ... 36 more

        This is the controller panel for Smart Panels app

            [CAM-2201] Camunda engine-rest throws NoClassDefFoundError: org.joda.time.DateTime when attempting to use DueAfter/DueBefore filter on TaskService-TaskRequest-getTasks()

            Tristan Rowley added a comment - - edited

            Line should be '$start = "2014-04-26T23:00:00";' (colons instead of hyphens to separate time - does not affect bug)

            Further info:
            Using camunda-bpm-jboss-7.1.0-Final.tar.gz.

            Same problem was encountered with camunda-bpm-jboss-7.0.0-Final.tar.gz too.

            Tristan Rowley added a comment - - edited Line should be '$start = "2014-04-26T23:00:00";' (colons instead of hyphens to separate time - does not affect bug) Further info: Using camunda-bpm-jboss-7.1.0-Final.tar.gz. Same problem was encountered with camunda-bpm-jboss-7.0.0-Final.tar.gz too.

            Can confirm that the same PHP query works correctly when using the Tomcat distribution, rather than the JBoss distribution.

            Seems the JBoss distribution doesn't build correctly. From digging into the pom files etc, which I don't fully understand, I can see that in some places the joda-time library is referred to as being version '1.2.1', whereas the jar is actually '2.1'.

            I presume this is the reason why the dependency is getting missed when the engine-rest war is being built.. I've tried quite a few things to add the joda-time jar to the war and have it be recognised, without success.

            Tristan Rowley added a comment - Can confirm that the same PHP query works correctly when using the Tomcat distribution, rather than the JBoss distribution. Seems the JBoss distribution doesn't build correctly. From digging into the pom files etc, which I don't fully understand, I can see that in some places the joda-time library is referred to as being version '1.2.1', whereas the jar is actually '2.1'. I presume this is the reason why the dependency is getting missed when the engine-rest war is being built.. I've tried quite a few things to add the joda-time jar to the war and have it be recognised, without success.

            Hi Tristan,

            thanks for reporting this, we will fix it for the upcoming release.

            Daniel

            Daniel Meyer added a comment - Hi Tristan, thanks for reporting this, we will fix it for the upcoming release. Daniel

            We should backport this one to 7.1.3

            Robert Gimbel added a comment - We should backport this one to 7.1.3

            I only backported it to 7.1.3

            Sebastian Menski added a comment - I only backported it to 7.1.3

              smirnov Roman Smirnov
              doctea Tristan Rowley
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: