ClassNotFoundException in AppKernel.php line 25:

Hi when I'm trying to load my symfony 2 app this issue comes,

ClassNotFoundException in AppKernel.php line 25: Attempted to load class "SonataDoctrineORMAdminBundle" from namespace "Sonata\DoctrineORMAdminBundle". Did you forget a "use" statement for another namespace?

This is my AppKernel.php file,

    <?php

use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            new Symfony\Bundle\SecurityBundle\SecurityBundle(),
            new Symfony\Bundle\TwigBundle\TwigBundle(),
            new Symfony\Bundle\MonologBundle\MonologBundle(),
            new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
            new Symfony\Bundle\AsseticBundle\AsseticBundle(),
            new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
            new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
            new AppBundle\AppBundle(),
            new kcc\AdminBundle\kccAdminBundle(),
            new JMS\SerializerBundle\JMSSerializerBundle(),
            new Sonata\CoreBundle\SonataCoreBundle(),
            new Sonata\BlockBundle\SonataBlockBundle(),
            new Knp\Bundle\MenuBundle\KnpMenuBundle(),
            new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
            new Sonata\AdminBundle\SonataAdminBundle(),
        );

        if (in_array($this->getEnvironment(), array('dev', 'test'), true)) {
            $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle();
            $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
            $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
            $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
        }

        return $bundles;
    }

    public function registerContainerConfiguration(LoaderInterface $loader)
    {
        $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
    }
}

This composer.json file,

{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-4": {
        "": "src/",
        "Sonata\\DoctrineORMAdminBundle\\": ""
    }
},
"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.7.*",
    "doctrine/orm": "^2.4.8",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~4.0",
    "sensio/framework-extra-bundle": "^3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "jms/serializer-bundle": "*",
    "weaverryan/derp-dangerzone": "dev-master",
    "vimuths123/menucreator": "dev-master",
    "sonata-project/admin-bundle": "^3.0",
    "sonata-project/doctrine-orm-admin-bundle": "^3.0",
    "sensio/generator-bundle": "2.3.*",
    "sonata-project/user-bundle": "^2.2",
    "friendsofsymfony/rest-bundle": "^1.7",
    "nelmio/api-doc-bundle": "^2.12",
    "sonata-project/core-bundle": "^3.0"
},
"require-dev": {
    "symfony/phpunit-bridge": "~2.7"
},
"scripts": {
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ],
    "post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
    ]
},
"config": {
    "bin-dir": "bin",
    "platform": {
        "php": "5.3.9"
    }
},
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web",
    "symfony-assets-install": "relative",
    "incenteev-parameters": {
        "file": "app/config/parameters.yml"
    },
    "branch-alias": {
        "dev-master": "2.7-dev"
    }
},
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/vimuths123/menucreator"
    }
]

}

I tried to update composer also but it's also unable due to this issue

First things First. Are you sure your composer.json file contain the following entries marked <== IMPORTANT:

        "require": {
        "php": "^5.3 || ^7.0",
            "doctrine/orm": "^2.3",
            "symfony/form": "^2.3 || ^3.0",
            "symfony/security": "^2.3 || ^3.0",
            "symfony/console": "^2.3 || ^3.0",
            "symfony/doctrine-bridge": "^2.2 || ^3.0",
            "symfony/framework-bundle": "^2.2 || ^3.0",
            "symfony/security-acl": "^2.2 || ^3.0",
            "sonata-project/exporter": "^1.3.1",
            "sonata-project/admin-bundle": "^3.0",    // <== IMPORTANT
            "sonata-project/core-bundle": "^3.0"      // <== IMPORTANT
        },
        "require-dev": {
        "simplethings/entity-audit-bundle": "~0.1",
            "symfony/phpunit-bridge": "^2.7 || ^3.0"
        },
        "suggest": {
        "simplethings/entity-audit-bundle": "If you want to support for versioning of entities and their associations."
        },
        "provide": {
        "sonata-project/admin-bundle-persistency-layer": "1.0.0"
        },
        "autoload": {
        "psr-4": { "Sonata\\DoctrineORMAdminBundle\\": "" }  // <== GOOD TO ADD
        },

symfony, First things First. Are you sure your composer.json file contain the following entries marked <== IMPORTANT: "require": { "php": "^5.3 || ^7.0", "doctrine/orm":  "ClassNotFoundException in AppKernel.php line 25: Attempted to load class "KnpPaginatorBundle" from namespace "Knp\Bundle\PaginatorBundle". Did you forget a "use" statement for another namespace?" When i try to use Bundle, all installed correctly, but, I've got :

as it is written in the documentation, you have to install the SonataDoctrineORMAdminBundle by composer:

composer require sonata-project/doctrine-orm-admin-bundle

If you follow the instructions on the symfony page it might help.

ClassNotFoundException · Issue #341 · KnpLabs , "ClassNotFoundException in AppKernel.php line 25: Attempted to load class "​KnpPaginatorBundle" from namespace "Knp\Bundle\  ClassNotFoundException in AppKernel.php line 20: Attempted to load class "BloggerBlogBundle" from namespace "Blogger\BlogBundle". Did you forget a "use" statement for another namespace? I really don't think I'm missing any use statements in AppKernel.php, and have tried adding more to no avail.

Just run this command

composer install/update

ClassNotFoundException в AppKernel.php ред 25:, ClassNotFoundException в AppKernel.php line 25: Опит за зареждане на клас "SonataDoctrineORMAdminBundle" от пространството на имената  Hi when I'm trying to load my symfony 2 app this issue comes, ClassNotFoundException in AppKernel.php line 25: Attempted to load class "SonataDoctrineORMAdminBundle" from namespace "Sonata\\

[Symfony] ClassNotFoundException in AppKernel.php par olix21 , ClassNotFoundException in AppKernel.php line 22:Attempted to load 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39. 40. 41. 42. 43. ClassNotFoundException in AppKernel.php line 19: Attempted to load class "KnpMarkdownBundle" from namespace "Knp\Bundle\MarkdownBundle". Did you forget a "use" statement for another namespace? in AppKernel.php line 19 at AppKernel->registerBundles() in Kernel.php line 403 at Kernel->initializeBundles() in Kernel.php line 113

Bundles > Symfony 3 Fundamentals: Bundles, Configuration , Script; (25+) Conversation. Woh! You're In your IDE, open up app/AppKernel.​php : 54 lines ClassNotFoundException in AppKernel.php line 19: Attempted to​  Dismiss Join GitHub today. GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.

SYMFONY_ENV=prod composer update --no-dev, Always add your Symfony, Aimeos and PHP version as well as your Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load in C:\wamp64\www\shop\app\AppKernel.php on line 30 Last edited by Seds on 25 Aug 2018, 10:30, edited 1 time in total. **. ClassNotFoundException in AppKernel.php line 19: Attempted to load class "OpenBundle" from namespace "vCoinOpenBundle". Did you forget a "use" statement for another namespace?

Comments
  • To update kernel, comment out the class from AppKernel and then update.
  • Really sorry but still get the issue Problem 1 - Installation request for sonata-project/doctrine-orm-admin-bundle ^3.0 -> satisfiable by sonata-project/doctrine-orm-admin-bundle[3.0.0]. - sonata-project/doctrine-orm-admin-bundle 3.0.0 requires sonata-project/adm in-bundle ^3.0 -> no matching package found.
  • Try adding sonata-project/admin-bundle ^3.0 in the composer.json then
  • In your Script try adding something like this at the top to import the Class : use Sonata\DoctrineORMAdminBundle\NAME_OF_THE_CLASS The idea is to import the Class before you are able to use it. Autoloader will take care of that.
  • added the files and still seems to be not working. Really sorry. And I updated with new composer.json file
  • Can you show us the context? I mean just copy & paste your import statements in your controller
  • I'm not using a controller since I'm working with sonata-admin... And I think for all pages this issue remains