skip to Main Content

When Trying to register my DummyController to use it as a Typo3 Plugin, I get the following error:
ServiceNotFoundException: You have requested a non-existent service "MyVendorNameTypo3StarterSitepackageControllerDummyController"

I tried to do everything like the documentation states, and also did some research, bud was unable to resolve the issue. Here is my code:

My controller:

<?php

namespace MyVendorNameTypo3StarterSitepackageController;

use PsrHttpMessageResponseInterface;

class DummyController extends ActionController
{
    public function dummyListAction(): ResponseInterface
    {
        return $this->htmlResponse();
    }
}

My DummyRepository.php:

<?php

namespace MyVendorNameTypo3StarterSitepackageDomainRepository;

use TYPO3CMSExtbasePersistenceQueryInterface;

class DummyRepository extends Repository
{
    // this already has some default functions, like findAll(), inherited from the Repository class.
}

My Services.yaml file:

services:
  # general settings
  _defaults:
    autowire: true
    autoconfigure: true
    public: false

  MyVendorNameTypo3StarterSitepackage:
    resource: '../Classes/*'

My ext_localconf.php:

<?php

use MyVendorNameTypo3StarterSitepackageControllerDummyController;
use TYPO3CMSExtbaseUtilityExtensionUtility;

defined('TYPO3') or die('Access denied.');
/***************
 * Add default RTE configuration
 */
// $GLOBALS['TYPO3_CONF_VARS']['RTE']['Presets']['typo3_starter_sitepackage'] = 'EXT:typo3_starter_sitepackage/Configuration/RTE/Default.yaml';

/***************
 * PageTS
 */
TYPO3CMSCoreUtilityExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:typo3_starter_sitepackage/Configuration/TsConfig/Page/All.tsconfig">');

ExtensionUtility::configurePlugin(
    'typo3_starter_sitepackage',
    'DummyList',
    [DummyController::class => 'dummyList'],
);

With this code I am able to select the Plugin through the Typo3 Backend, but then the ServiceNotFoundException is thrown. I am aware that the Controller doesn’t return anything right now, but I think that’s not the cause of this issue.

I am working on Windows using XAMPP with PHP 8.2, Typo3 12.4.10.

2

Answers


  1. Chosen as BEST ANSWER

    I was finally able to fix the issue. There were two main problems with my installation and honestly I want to partially blame TYPO3 quirks and insufficient documentation for it. Anyway, here is how I fixed it:

    • Although the TYPO3 website states that typo3 12 is compatible with PHP 8.2, I had some issues with it, mainly some weird doctrine errors, and eventually switched to PHP 8.1.
    • The composer.json file came with predefined "typo3-cms-scripts", where typo3cms install:fixfolderstructure was called. This never worked for me, as this path is seemingly wrong for typo3 12. Instead I set typo3 cache:flush and typo3 cache:warmup.

    After that, I deleted my composer.lock file and my vendor folder and freshly installed the composer packages (this might not have been necessary). The post autoload dump script, that now clears the typo3 caches, ran without errors and the ServiceNotFoundException went away.


  2. Casual errors related to these cases are:

    • Recheck exactly the casing of the class and namespace, in Services.yaml, the file and the corresponding composer.json autoload namespace (+ext_emconf.php autoload section for legacy mode).
    • Check that you really has not excluded the controller

    and try to rebuild caches

    vendor/bin/typo3 cache:flush
    vendor/bin/typo3 cache:warump
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search