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

**URL:** <https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981>\
**Category:** Q&A\
**Created:** [4 November 2021 16:18 UTC](https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981 "2021-11-04T16:18:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssp-kevin.toyne](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@ssp-kevin.toyne](https://community.ofelia.com/u/ssp-kevin.toyne)\
**Post date:** [4 November 2021 16:18 UTC](https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981/1 "2021-11-04T16:18:41Z")

</div>

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:

```
http://community.ofelia.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)
```

---

<div class="post-metadata">

**Author:** ![ssp-kevin.toyne](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@ssp-kevin.toyne](https://community.ofelia.com/u/ssp-kevin.toyne)\
**Post date:** [15 November 2021 14:27 UTC](https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981/2 "2021-11-15T14:27:31Z")

</div>

Remember to login before testing!

---

<div class="post-metadata">

**Author:** ![romain.bioteau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/romain.bioteau/32/720_2.png) [@romain.bioteau](https://community.ofelia.com/u/romain.bioteau)\
**Post date:** [8 November 2021 08:36 UTC](https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981/3 "2021-11-08T08:36:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ssp-kevin.toyne](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@ssp-kevin.toyne](https://community.ofelia.com/u/ssp-kevin.toyne)\
**Post date:** [15 November 2021 14:19 UTC](https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981/4 "2021-11-15T14:19:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![romain.bioteau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/romain.bioteau/32/720_2.png) [@romain.bioteau](https://community.ofelia.com/u/romain.bioteau)\
**Post date:** [15 November 2021 12:50 UTC](https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981/5 "2021-11-15T12:50:57Z")

</div>

You get a 401 because you need to pass the authentication header in your [curl request](https://documentation.bonitasoft.com/bonita/2021.2/api/rest-api-authentication#_example_using_curl).  
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](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)

---

<div class="post-metadata">

**Author:** ![ssp-kevin.toyne](https://avatars.discourse-cdn.com/v4/letter/s/977dab/32.png) [@ssp-kevin.toyne](https://community.ofelia.com/u/ssp-kevin.toyne)\
**Post date:** [15 November 2021 14:26 UTC](https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981/6 "2021-11-15T14:26:40Z")

</div>

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`

---

<div class="post-metadata">

**Author:** ![romain.bioteau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.ofelia.com/romain.bioteau/32/720_2.png) [@romain.bioteau](https://community.ofelia.com/u/romain.bioteau)\
**Post date:** [15 November 2021 15:37 UTC](https://community.ofelia.com/t/using-the-rest-api-extension-and-getting-component-class-is-null-on-clean-install-of-2021-12/10981/7 "2021-11-15T15:37:54Z")

</div>

Glad it was _just_ that !

Have fun
