Using the REST API Extension and getting "component class is null" on clean install of 2021.[12]

1
0
-1

Going through the tutorial to deploy a REST API extension:

https://documentation.bonitasoft.com/bonita/2021.1/rest-api-extensions

On completion, calling the service had no data in the response. Looking to the logs, found the following:

INFO (http-nio-8080-exec-1) org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/bonita] RestletServlet: [Restlet] ServerServlet: component class is null

Found an already existing question:

https://community.bonitasoft.com/questions-and-answers/restlet-serverservlet-component-class-null

but this was from 2015 and referenced JBoss, which I am not using.

The initial tests were using Bonita Studio, but also tested on fresh docker deployments of both 2021.1 ("FROM bonita:2021.1") and 2021.2 ("FROM bonita:2021.2"), but getting the same result on all three.

Any help would be appreciated.

---

OS used is Fedora 33, fully updated. Default installed Java is reporting as:

openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment 18.9 (build 11.0.13+8)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.13+8, mixed mode, sharing)

and inside "BonitaStudioCommunity-2021.1/jre/bin" reporting as:

openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.8+10, mixed mode)

Comments

Submitted by romain.bioteau on Mon, 11/08/2021 - 09:36

Hi,

As the log is in INFO I'm not sure that it explains the cause of your issue. Can you give us more information (logs, request status in the browser dev mode...etc) ?

Romain

Submitted by ssp-kevin.toyne on Mon, 11/15/2021 - 15:19

The following is from a fresh start via Bonita Studio, without `INFO` lines:

15-Nov-2021 09:47:08.631 FINE [main] org.jboss.narayana.tomcat.jta.TransactionLifecycleListener.lifecycleEvent Initializing Narayana
15-Nov-2021 09:47:34.787 WARNING [localhost-startStop-1] org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl.log THREAD_ID=23 | HOSTNAME=myhost | Can't cache the platform, maybe the platform cache service is not started yet: The cache is not started, call start() on the cache service
15-Nov-2021 09:47:34.809 WARNING [localhost-startStop-1] org.bonitasoft.engine.log.technical.TechnicalLoggerSLF4JImpl.log THREAD_ID=23 | HOSTNAME=myhost | Can't cache the platform, maybe the platform cache service is not started yet: The cache is not started, call start() on the cache service
  Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally.
  NOT STARTED.
  Currently in standby mode.
  Number of jobs executed: 0
  Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 5 threads.
  Using job-store 'org.bonitasoft.engine.scheduler.impl.BonitaJobStoreCMT' - which supports persistence. and is not clustered.

Time Tracker 'org.bonitasoft.engine.tracking.TimeTracker':
  - trackingEnabled: false
  - flushIntervalInSeconds: 30000
  - activatedRecords: EXECUTE_CONNECTOR_INCLUDING_POOL_SUBMIT EXECUTE_CONNECTOR_DISCONNECT EXECUTE_CONNECTOR_CALLABLE EXECUTE_CONNECTOR_OUTPUT_OPERATIONS EXECUTE_CONNECTOR_INPUT_EXPRESSIONS EVALUATE_EXPRESSION EVALUATE_EXPRESSION_INCLUDING_CONTEXT EXECUTE_CONNECTOR_WORK EVALUATE_EXPRESSIONS
  - flushEventListeners: org.bonitasoft.engine.tracking.memory.MemoryFlushEventListener:
active: false
No DayRecord registered in memory. org.bonitasoft.engine.tracking.csv.CSVFlushEventListener:
active: true
outputFolder: /home/bontest/BonitaStudioCommunity-2021.1/workspace/tomcat/server/temp

  - records.size: 0
  - last flush occurrence: Thu Jan 01 01:00:00 GMT 1970

-----
15-Nov-2021 09:47:40.519 WARNING [Thread-13] org.bonitasoft.console.server.listener.StudioWatchdogListener$1.run Bonita Studio watchdog process has started on port 6969 with a delay set to 20000 ms
15-Nov-2021 09:47:41.872 SEVERE [http-nio-8080-exec-3] org.bonitasoft.engine.business.data.generator.EntityCodeGenerator.determineDbVendor sysprop.bonita.bdm.db.vendor is not set. This should not happen at runtime. Defaulting to h2.

When using `curl` to test the API, there are no additional log events, but nothing is returned:

$> curl -v "http://localhost:8080/bonita/API/extension/userInformation?p=0&c=10"
*   Trying ::1:8080...
* Connected to localhost (::1) port 8080 (#0)
> GET /bonita/API/extension/userInformation?p=0&c=10 HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.71.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 401
< Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate
< Set-Cookie: JSESSIONID=C921180AEC757942B35614ABC3C2B7DC; Path=/; HttpOnly; SameSite=Lax
< Content-Length: 0
< Date: Mon, 15 Nov 2021 10:03:18 GMT
<
* Connection #0 to host localhost left intact

I also get the same if I use the following:

curl -v "http://localhost:8080/bonita/API/"

Or indeed anything stemming from this.

Advise if additional info is required.

Submitted by romain.bioteau on Mon, 11/15/2021 - 13:50

You get a 401 because you need to pass the authentication header in your curl request.
You might just want to use a web browser a log in to the user app, and then just call the http://localhost:808/bonita/API/extension/userInformation?p=0&c=10 directly from the browser url.
Using dev tools will provide additional information on the request (status, header, response...etc)

Submitted by ssp-kevin.toyne on Mon, 11/15/2021 - 15:26

Whoops. Missed that! Exactly the same in the browser, I was testing without logging in. Once logged in, all good.

Thank you for that, much appreciate the assistance leading the blind. Wood for trees and missed that it was returning a `401`

Submitted by romain.bioteau on Mon, 11/15/2021 - 16:37

Glad it was just that !

Have fun

1 answer

1
0
-1
This one is the BEST answer!

Remember to login before testing!

Notifications