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

FetchAndLock of external task is not working with Spring Boot Starter

    • Icon: Bug Report Bug Report
    • Resolution: Fixed
    • Icon: L3 - Default L3 - Default
    • spring-boot 3.0.0
    • spring-boot 3.0.0-alpha1
    • spring-boot
    • None

      Given:

      • I have an application using Spring Boot Starter 3.0.0-alpha1

      When

      • I try to call "fetch and lock" from REST API

      Then:

      • NPE is thrown:
        java.lang.NullPointerException: null
        at org.camunda.bpm.engine.rest.impl.FetchAndLockRestServiceImpl.fetchAndLock(FetchAndLockRestServiceImpl.java:34)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        

      Reported on forum: https://forum.camunda.org/t/externaltasks-fetchandlock-nullpointerexception/7473/8

        This is the controller panel for Smart Panels app

            [CAM-9111] FetchAndLock of external task is not working with Spring Boot Starter

            Michał Sądel added a comment - - edited

            One more thing I've noticed. The problem exists when we use gradle, when we use maven instead there is no problem at all. In case of gradle FetchAndLockRestService is chosen to handle the http method in case of maven ExternalTaskRestService is chosen. Hopes this helps you a bit.

            Here is a pom.xml definition to work with the Github project

            Michał Sądel added a comment - - edited One more thing I've noticed. The problem exists when we use gradle, when we use maven instead there is no problem at all. In case of gradle FetchAndLockRestService is chosen to handle the http method in case of maven ExternalTaskRestService is chosen. Hopes this helps you a bit. Here is a pom.xml definition to work with the Github project

            Svetlana Dorokhova added a comment - - edited

            Hi Michał,

            you're probably using different versions of Spring Boot Starter. ExternalTaskRestService is the service from older version, which is in the newer version replaced by FetchAndLockRestService. Moreover I created (and pushed already) the integration test, which was failing before the fix (and it does not depend on building tool for sure).

            Can you check Spring Boot Starter version in you pom.xml?

            Svetlana Dorokhova added a comment - - edited Hi Michał, you're probably using different versions of Spring Boot Starter. ExternalTaskRestService is the service from older version, which is in the newer version replaced by FetchAndLockRestService . Moreover I created (and pushed already) the integration test, which was failing before the fix (and it does not depend on building tool for sure). Can you check Spring Boot Starter version in you pom.xml ?

            Svetlana Dorokhova added a comment - - edited

            Ah, sorry, you've posted the pom.xml and it looks fine. Let me think...

            Svetlana Dorokhova added a comment - - edited Ah, sorry, you've posted the pom.xml and it looks fine. Let me think...

            Hi Michał,
            I would say, that there should be no difference between Gradle and Maven, but as we don't use Gradle I can't say for sure.

            ExternalTaskRestService can be chosen in your case, if you request REST API coming with the Webapps. Basically with your configuration, including both webapp and rest starters you will have 2 REST APIs available. One within Webapps, one from Rest starter. Endpoints in this REST APIs will have different URLs. When you call an endpoint from webapp, ExternalTaskRestService is called (no long-polling available). When you call the one from rest, FetchAndLockRestService will be called (with long-polling available).

            Anyway after the fix, both endpoints should work.

            Svetlana Dorokhova added a comment - Hi Michał, I would say, that there should be no difference between Gradle and Maven, but as we don't use Gradle I can't say for sure. ExternalTaskRestService can be chosen in your case, if you request REST API coming with the Webapps. Basically with your configuration, including both webapp and rest starters you will have 2 REST APIs available. One within Webapps, one from Rest starter. Endpoints in this REST APIs will have different URLs. When you call an endpoint from webapp , ExternalTaskRestService is called (no long-polling available). When you call the one from rest , FetchAndLockRestService will be called (with long-polling available). Anyway after the fix, both endpoints should work.

            Hi Svetlana ,
            Thank you for support.

            Michał Sądel added a comment - Hi Svetlana , Thank you for support.

              yana.vasileva Yana Vasileva
              svetlana.dorokhova Svetlana Dorokhova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: