Child Service [admin] does not exist in fecshop\services\Application, you must config it!

安装报错 · findman · 于 4年前 发布 · 2041 次阅读

2.16版本 根据Fecmall-2.x WAMP环境安装 - 手把手系列安装。 Invalid Configuration – yii\base\InvalidConfigException Child Service [admin] does not exist in fecshop\services\Application, you must config it!

1. in D:\wamp64\www\fecshop\vendor\fancyecommerce\fecshop\services\Application.php at line 120
111112113114115116117118119120121122123124125126127128129            $childService = $this->childService;
            if (isset($childService[$childServiceName])) {
                $service = $childService[$childServiceName];
                if (!isset($service['enableService']) || $service['enableService']) {
                    $this->_childService[$childServiceName] = Yii::createObject($service);
                } else {
                    throw new InvalidConfigException('Child Service ['.$childServiceName.'] is disabled in '.get_called_class().', you must enable it! ');
                }
            } else {
                throw new InvalidConfigException('Child Service ['.$childServiceName.'] does not exist in '.get_called_class().', you must config it! ');
            }
        }
 
        return isset($this->_childService[$childServiceName]) ? $this->_childService[$childServiceName] : null;
    }
 
    /**
     * 魔术方法,当调用一个属性,对象不存在的时候就会执行该方法,然后
     * 根据构造方法注入的配置,实例化service对象。
2. in D:\wamp64\www\fecshop\vendor\fancyecommerce\fecshop\services\Application.php at line 136 – fecshop\services\Application::getChildService('admin')
130131132133134135136137138     * @var string $serviceName service name
     * @return \fecshop\services\Service
     * @throws \yii\base\InvalidConfigException if the service does not exist or the service is disabled
     */
    public function __get($serviceName)
    {
        return $this->getChildService($serviceName);
    }
}
3. in D:\wamp64\www\fecshop\vendor\fancyecommerce\fecshop\components\Store.php at line 41 – fecshop\services\Application::__get('admin')
35363738394041424344454647 
 
    // 初始化的bootstrap
    public function bootstrap($app)
    {
        if ($this->appName == 'appadmin') {
            Yii::$service->admin->bootstrap($app);
        } else {
            Yii::$service->store->bootstrap($app);
        }
    }
    // 得到配置值
    /**
4. in D:\wamp64\www\fecshop\vendor\yiisoft\yii2\base\Application.php at line 327 – fecshop\components\Store::bootstrap(yii\web\Application)
5. in D:\wamp64\www\fecshop\vendor\yiisoft\yii2\web\Application.php at line 69 – yii\base\Application::bootstrap()
6. in D:\wamp64\www\fecshop\vendor\yiisoft\yii2\base\Application.php at line 273 – yii\web\Application::bootstrap()
7. in D:\wamp64\www\fecshop\vendor\yiisoft\yii2\base\BaseObject.php at line 109 – yii\base\Application::init()
8. in D:\wamp64\www\fecshop\vendor\yiisoft\yii2\base\Application.php at line 206 – yii\base\BaseObject::__construct(['aliases' => ['@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset'], 'components' => ['urlManager' => ['class' => 'yii\web\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => ['' => 'fecadmin/index/index']], 'db' => ['class' => 'yii\db\Connection', 'dsn' => 'mysql:host=127.0.0.1;dbname=fecm...', 'username' => 'root', 'password' => '123456', ...], 'mongodb' => ['class' => 'yii\mongodb\Connection', 'dsn' => 'mongodb://127.0.0.1:27017/fecsho...'], 'cache' => ['class' => 'yii\caching\FileCache', 'keyPrefix' => 'appadmin_cache'], ...], 'id' => 'app-admin', 'controllerNamespace' => 'appadmin\controllers', ...])
9. in D:\wamp64\www\fecshop\appadmin\web\index.php at line 76 – yii\base\Application::__construct(['aliases' => ['@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset'], 'components' => ['urlManager' => ['class' => 'yii\web\UrlManager', 'enablePrettyUrl' => true, 'showScriptName' => false, 'rules' => ['' => 'fecadmin/index/index']], 'db' => ['class' => 'yii\db\Connection', 'dsn' => 'mysql:host=127.0.0.1;dbname=fecm...', 'username' => 'root', 'password' => '123456', ...], 'mongodb' => ['class' => 'yii\mongodb\Connection', 'dsn' => 'mongodb://127.0.0.1:27017/fecsho...'], 'cache' => ['class' => 'yii\caching\FileCache', 'keyPrefix' => 'appadmin_cache'], ...], 'id' => 'app-admin', 'controllerNamespace' => 'appadmin\controllers', ...])
70717273747576777879808182 * 使用方法:Yii::$service->cms->article;
 * 上面的例子就是获取cms服务的子服务article。
 */
new fecshop\services\Application($config['services']);
unset($config['services']);
 
$application = new yii\web\Application($config);
$application->run();
 
 
 
 
 
 $_COOKIE = [
    'SL_GWPT_Show_Hide_tmp' => '1',
    'SL_wptGlobTipTmp' => '1',
];
共收到 4 条回复
Fecmall#14年前 0 个赞

2.1版本这么久了,没有人出过这个错误

admin services就是这个文件:https://github.com/fecshop/yii2_fecshop/blob/master/services/Admin.php

如果全新安装2.1,不会出这个错误的,自己重新下载试试。

wangyaxiong#24年前 0 个赞

lnmp和windows环境下所有步骤都配置完以后访问后台遇到同样问题,跪求

Fecmall#34年前 0 个赞

@wangyaxiong #2楼

1.这个问题,自己排查一下,无法重现

2.可以试试 2.2.1版本

3.上面已经回复相应的文件。自己调试找找问题所在

Fecmall#44年前 0 个赞

参看帖子解决:http://www.fecmall.com/topic/2096

添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册
Your Site Analytics