Middlevare - is not defined

Hello,
I’m again at the end of mine knowlege and hope that someone could help me - I have a middleware and want to register it, but I’m still not able to register as I got message that it is not defined, here is the error message:

  • Type: Pimple\Exception\UnknownIdentifierException
  • Code: 0
  • Message: Identifier “OCA\DeviceApp\Middleware\ExceptionMiddleware” is not defined.
  • File: /var/www/html/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php

here is the Application PHP with registration:

namespace OCA\DeviceApp\AppInfo;


use \OCA\DeviceApp\Middleware\ExceptionMiddleware;

class Application extends App {

private $server;

public function __construct(array $urlParams = ) {
parent::__construct(‘deviceapp’, $urlParams);

  $container = $this->getContainer();
  $server = $this->getContainer()->getServer();

  $this->server = $server;

  $container->registerMiddleWare(ExceptionMiddleware::class);

}

and here is the part of middleware file:

namespace OCA\DeviceApp\Middleware;

use \OCP\AppFramework\Middleware;
use \OCP\ILogger;
use \OCP\IConfig;

class ExceptionMiddleware extends Middleware {

private $logger;

private $config;

public function __construct(ILogger $logger, IConfig $config) {
$this->logger = $logger;
$this->config = $config;
}
}

I can’t find why the file is not found on the (hope) right place

nextcloud\apps\deviceapp\lib\Middleware\ExceptionMiddleware.php

I’m using Nextcloud v.17.0.6, in v. 18 the result is the same.

Thank you in advance for any advise.

Bob

autoloaders are up to date and also included by your app.php?

Thank you Kesselb for the reply, here is the app.php

use OCA\DeviceApp\AppInfo\Application;
use OCP\AppFramework\QueryException;

if ((@include_once DIR . ‘/…/vendor/autoload.php’)=== false) {
throw new Exception(‘Cannot include autoload. Did you run install dependencies using composer?’);
}
try {
/** @var Application $app */
$app = \OC::$server->query(Application::class);
$app->register();
} catch (QueryException $e) {
}

autoload version is “1.3.0”,

Run composer dump-autoload in vendor/.

Thank you, Done, I got info that autoload files containing 1496 files, but the result is still the same.


solved - I used wrong Nextcloud version (sample app was for Nextcloud version 18-19, I used v. 17 ) - thank you for your support which help me to find the problem.
Bob