Ошибка controller class not found default controller

#1

yellowboris

  • JBZoo User (rus)
  • Общий рейтинг:
    ~

  • сообщений: 2
  • топиков: 1

Отправлено 28 December 2012 — 09:09

Прочел FAQ, но ответа не нашел….  System — JBZoo (events) — ативен. Вверху весит сообьщение Please, register your JBZoo copy! Click me!. При попытке создания нового каталога он не сохраняется и продолжает весеть сообщение Please, register your JBZoo copy! Click me!. При клике появляется окошко с шибкой: «500 — Обнаружена ошибка. Controller class not found. (defaultController)».

  • 0

  • Наверх

#2


SmetDenis

Отправлено 28 December 2012 — 11:24
  Лучший Ответ

Создайте новый каталог с английским алиасом.
Бывает так что перед созданием первого каталога лучше выключить плагин, затем обратно включите иначе не будет корректно работать фильтр.

  • 0

  • Наверх

#3


yellowboris

yellowboris

  • Topic Starter
  • JBZoo User (rus)
  • Общий рейтинг:
    ~

  • сообщений: 2
  • топиков: 1

Отправлено 28 December 2012 — 11:48

Здорово, все заработало. Спасибо. ;)

  • 0

  • Наверх

#1

yellowboris

  • JBZoo User (rus)
  • Общий рейтинг:
    ~
  • сообщений: 2
  • топиков: 1

Отправлено 28 December 2012 — 09:09

Прочел FAQ, но ответа не нашел….  System — JBZoo (events) — ативен. Вверху весит сообьщение Please, register your JBZoo copy! Click me!. При попытке создания нового каталога он не сохраняется и продолжает весеть сообщение Please, register your JBZoo copy! Click me!. При клике появляется окошко с шибкой: «500 — Обнаружена ошибка. Controller class not found. (defaultController)».

  • 0

  • Наверх

#2


SmetDenis

Отправлено 28 December 2012 — 11:24
  Лучший Ответ

Создайте новый каталог с английским алиасом.
Бывает так что перед созданием первого каталога лучше выключить плагин, затем обратно включите иначе не будет корректно работать фильтр.

  • 0

  • Наверх

#3


yellowboris

yellowboris

  • Topic Starter
  • JBZoo User (rus)
  • Общий рейтинг:
    ~
  • сообщений: 2
  • топиков: 1

Отправлено 28 December 2012 — 11:48

Здорово, все заработало. Спасибо. ;)

  • 0

  • Наверх

I have started a Symfony2 tutorial, and created a default project using Intellij Idea.

When I try to run the project, I get the following error:

Fatal error: Class 'SymfonyBundleFrameworkBundleControllerController' not found in
C:Users[...]SymfonyTrainingsrcAppBundleControllerDefaultController.php
on line 10

It relates to the following file:

<?php

namespace AppBundleController;

use SymfonyBundleFrameworkBundleControllerController;
use SensioBundleFrameworkExtraBundleConfigurationRoute;
use SymfonyComponentHttpFoundationRequest;

class DefaultController extends Controller
{
    /**
     * @Route("/", name="homepage")
     */
    public function indexAction(Request $request)
    {
        // replace this example code with whatever you need
        return $this->render('default/index.html.twig', [
            'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
        ]);
    }
}

?>

All the answers I found were about missing namespace or use, or typos, but it doesn’t seems to be it.

Any idea ?

(maybe it’s just something obvious I don’t see)

A pretty common issue for Spring Boot application is a 404 Not Found Error for your REST Controllers. Let’s learn how to fix it in one minute!

Problem description

You are running a Spring Boot application which includes a REST Controller, as in this example:

package com.example.controller; 
@RestController // shorthand for @Controller and @ResponseBody rolled together
public class ExampleController {
   
   @RequestMapping( "/hello" )
   public String echo() {
      return "Hello World!";
   }

}

To run your Spring Boot application you are using an Application Main class:

package com.example.application;
@SpringBootApplication 
public class MainApp {
   public static void main( String[] args ) {
      SpringApplication.run( MainApp.class, args );
   }
}

Then, you request for the “/hello” endpoint but you get a 404 error:

$ curl http://localhost:8080/hello

{
  "timestamp": 9853742596220,
  "status": 404,
  "error": "Not Found",
  "message": "No message available",
  "path": "/hello"
}

How to fix the issue

To understand what is the issue, we need to focus on the @SpringBootApplication annotation. As a matter of fact, this annotation it’s a combination of three annotations:

@Configuration
@EnableAutoConfiguration
@ComponentScan

The default @ComponentScan annotation (without arguments) tells Spring to scan the current package and all of its sub-packages..

Therefore, only classes under the package “com.example.application” will be scanned. There are two ways to fix it.

Solution #1

The best practice is to place the Main Application class at the root of your project. This way, it will automatically scan and find the Controller class which are available in a sub-package. For example, here is a package structure that works:

spring boot controller not found

In the above project, we have placed the DemoApplication class at the root of other packages, therefore you will not have issues in finding other classes.

Solution #2

As another option, you could add to your @ComponentScan annotation the starting point used to scan for Classes:

@ComponentScan(basePackages = "com.myapp.demo")
@Configuration
public classDemoApplication {
   // ...
}

We have just covered some options to fix a common error in Spring Boot applications, related to REST Controller not found.

Я не говорю по-английски (я француз), поэтому буду следовать руководству здесь и я получил эту структуру

Application
--Modules
------admin
---------controller
---------views
------etat
---------controller
---------views
------default
---------controller
---------views
--configs
bootstrap.php

Моя проблема в том, что когда я создал свою первую форму и попытался просмотреть ее в своем браузере, я получил следующую ошибку:

Неустранимая ошибка: класс Admin_Form_Login не найден в C: wamp www get application modules default controllers IndexController.php в строке 14.

Вот мой код:

  • Мой контроллер: /modules/etat/controller/IndexController.php
    class Etat_IndexController extends Zend_Controller_Action
    {
    
        public function init()
        {
            /* Initialize action controller here */
        }
    
        public function indexAction()
        {
            // action body
            $form = new Etat_Form_InfoAgent();
            $this->view->form = $form;
        }
    }
    
  • Моя форма: /modules/etat/forms/InfoAgent.php
    class Etat_Form_InfoAgent extends Zend_Form
    {
    
        public function init()
        {
            /* Form Elements & Other Definitions Here ... */
            $this->setName('infoagent');
            $this->setMethod('post');
    
            $login = new Zend_Form_Element_Text('matricule');
            $login->setLabel('Matricule:');
            $login->setRequired(true);
            $login->addFilter('StripTags');
            $login->addFilter('StringTrim');
            $this->addElement($login);
    
            $password = new Zend_Form_Element_Password('agence');
            $password->setLabel('Code agence:');
            $password->setRequired(true);
            $password->addFilter('StripTags');
            $password->addFilter('StringTrim');
            $this->addElement($password);
    
            $submit = new Zend_Form_Element_Submit('submit');
            $submit->setLabel('Valider');
            //$submit->style = array('float: right');
            $this->addElement($submit);       
        }
    
    
    }
    
  • Мой вид : /modules/etat/view/script/index.phtml
    <br /><br />
    <div id="view-content">
        <?php echo $this->form; ?>
    </div>
    
  • Конфигурационный файл : configs/application.ini
    [production]
    phpSettings.display_startup_errors = 0
    phpSettings.display_errors = 0
    includePaths.library = APPLICATION_PATH "/../library"
    bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
    bootstrap.class = "Bootstrap"
    appnamespace = "Application"
    resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
    resources.frontController.params.displayExceptions = 0
    
    ;Modular structure
    resources.modules[] =
    
    resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
    resources.frontController.params.prefixDefaultModule = "1"
    
    ;database ressources
    resources.db.adapter = PDO_MYSQL
    resources.db.params.host = localhost
    resources.db.params.username = root
    resources.db.params.password = 
    resources.db.params.dbname = bd_test
    
    [staging : production]
    
    [testing : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    
    [development : production]
    phpSettings.display_startup_errors = 1
    phpSettings.display_errors = 1
    resources.frontController.params.displayExceptions = 1
    

    Я искал в Интернете решение, но не нашел. Я видел сообщение о той же проблеме на вашем веб-сайте (stackoverflow), и я попытался применить ваши инструкции, не решив свою проблему. я уверен, что я не менял код в моем загрузчике и моем public/index.php файл

    Надеюсь, ты скоро сможешь мне помочь. Спасибо

  • I have started a Symfony2 tutorial, and created a default project using Intellij Idea.

    When I try to run the project, I get the following error:

    Fatal error: Class 'SymfonyBundleFrameworkBundleControllerController' not found in
    C:Users[...]SymfonyTrainingsrcAppBundleControllerDefaultController.php
    on line 10
    

    It relates to the following file:

    <?php
    
    namespace AppBundleController;
    
    use SymfonyBundleFrameworkBundleControllerController;
    use SensioBundleFrameworkExtraBundleConfigurationRoute;
    use SymfonyComponentHttpFoundationRequest;
    
    class DefaultController extends Controller
    {
        /**
         * @Route("/", name="homepage")
         */
        public function indexAction(Request $request)
        {
            // replace this example code with whatever you need
            return $this->render('default/index.html.twig', [
                'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..'),
            ]);
        }
    }
    
    ?>
    

    All the answers I found were about missing namespace or use, or typos, but it doesn’t seems to be it.

    Any idea ?

    (maybe it’s just something obvious I don’t see)

    I am new to symfony and maybe I am missing something really simple but I am not able to spot it. Any help will be much appreciated. I have these two files:

    C:xampphtdocsSymfonysrcApps01ResourceCalBundleResourcesconfigrouting.yml

    ResourceCalendar_Login:
        pattern:   /resourcecalendar/login
        defaults:  { _controller: AppsRollerResourceCalBundle:Login:DisplayLogin }
    

    C:xampphtdocsSymfonysrcApps01ResourceCalBundleControllerLoginController.php

    use SymfonyBundleFrameworkBundleControllerController;
    use SymfonyComponentHttpFoundationResponse;
    
    class LoginController
    {
    public function DisplayLoginAction()
    {
        return new Response('<html><body>Hello There!</body></html>');
    }
    }
    

    Yet when I point my browser to http://example.com/Symfony/web/app_dev.php/resourcecalendar/login I get the following error:

     The autoloader expected class "Apps01ResourceCalBundleControllerLoginController" to be defined in file "C:xampphtdocsSymfony/src/Apps01ResourceCalBundleControllerLoginController.php". The file was found but the class was not in it, the class name or namespace probably has a typo.
     500 Internal Server Error - RuntimeException 
    

    Can someone point out what I am missing when I can see that the class LoginController is definitely there inside the filer?

    Thanks
    Al

    Здравствуйте! Не подскажете, почему в этом файле возникает ошибка Class ‘appHttpControllersController’ not found

    <?php
    
    
    namespace App;
    
    use DB;
    use appHttpControllersController;
    
    class Site extends Controller
    {
        function __construct($domainid , $userid , $vhostid)
        {
            $this->domainid = $domainid;
            $this->userid = $userid;
            $this->vhostid = $vhostid;
        }
    
        /**
         *
         *
         * @return Response
         */
        private function checkbelong ($domainid, $userid , $vhostid)
        {
            $checkdom = DB::table("domain")
                ->select('unid')
                ->where("userid",  $userid)
                ->where ("unid" , $domainid)
                ->where("type" , "unlinked")
            ->get();
            $checkvh = DB::table("vhosts")
                ->select('unid')
                ->where("userid",  $userid)
                ->where ("unid" , $vhostid)
                ->get();
            var_dump($checkvh);
    if (!$checkvh OR !$checkdom) {return $error = "Trying to link foreign domain";}
    else {return true;}
        }
        private function checkexist ($domainid,$vhostid) {
            $checkdom = DB::table("domain")
            ->select('unid')
            ->where ("unid" , $domainid)
            ->where("type" , "unlinked")
            ->get();
            $checkvh = DB::table("vhosts")
                ->select('unid')
                ->where ("unid" , $vhostid)
                ->get();
            if (!$checkvh OR !$checkdom) {return $error = "Trying to link non-existent domain";}
            else {return true;}
        }
    }

    Опытным путём выяснил, что ошибку вызывает эта часть строки: class Site extends Controller

  • Ошибка control channel disconnect exception
  • Ошибка content not found
  • Ошибка content manager assetto corsa
  • Ошибка contactor inpl 115 steer
  • Ошибка contact your support personnel