I'm getting this error message when trying to access the admin:
1 exception(s):
Exception #0 (LogicException): Could not create an acl object: The XML in file "C:/xampp/htdocs/magento2-dshop/app/code/Dshop/ModuloBasico/etc/acl.xml" is invalid:
Element 'config', attribute '{http://www.w3.org/2001/XMLSchema-instance}noNamespaceShcemaLocation': The attribute '{http://www.w3.org/2001/XMLSchema-instance}noNamespaceShcemaLocation' is not allowed.
Line: 2
Verify the XML and try again.
Exception #0 (LogicException): Could not create an acl object: The XML in file "C:/xampp/htdocs/magento2-dshop/app/code/Dshop/ModuloBasico/etc/acl.xml" is invalid:
Element 'config', attribute '{http://www.w3.org/2001/XMLSchema-instance}noNamespaceShcemaLocation': The attribute '{http://www.w3.org/2001/XMLSchema-instance}noNamespaceShcemaLocation' is not allowed.
Line: 2
Verify the XML and try again.
#1 Magento\Framework\Acl\Builder\Proxy->getAcl() called at [vendor\magento\module-backend\Model\Auth\Session.php:261] #2 Magento\Backend\Model\Auth\Session->processLogin() called at [generated\code\Magento\Backend\Model\Auth\Session\Interceptor.php:77] #3 Magento\Backend\Model\Auth\Session\Interceptor->processLogin() called at [vendor\magento\module-backend\Model\Auth.php:165] #4 Magento\Backend\Model\Auth->login() called at [vendor\magento\framework\Interception\Interceptor.php:58] #5 Magento\Backend\Model\Auth\Interceptor->___callParent() called at [vendor\magento\framework\Interception\Interceptor.php:138] #6 Magento\Backend\Model\Auth\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor\magento\framework\Interception\Interceptor.php:153] #7 Magento\Backend\Model\Auth\Interceptor->___callPlugins() called at [generated\code\Magento\Backend\Model\Auth\Interceptor.php:59] #8 Magento\Backend\Model\Auth\Interceptor->login() called at [vendor\magento\module-backend\App\Action\Plugin\Authentication.php:205] #9 Magento\Backend\App\Action\Plugin\Authentication->_performLogin() called at [vendor\magento\module-backend\App\Action\Plugin\Authentication.php:157] #10 Magento\Backend\App\Action\Plugin\Authentication->_processNotLoggedInUser() called at [vendor\magento\module-backend\App\Action\Plugin\Authentication.php:125] #11 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [vendor\magento\framework\Interception\Interceptor.php:135] #12 Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor\magento\framework\Interception\Interceptor.php:153] #13 Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor->___callPlugins() called at [generated\code\Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor.php:32] #14 Magento\Backend\Controller\Adminhtml\Index\Index\Interceptor->dispatch() called at [vendor\magento\framework\App\FrontController.php:186] #15 Magento\Framework\App\FrontController->processRequest() called at [vendor\magento\framework\App\FrontController.php:118] #16 Magento\Framework\App\FrontController->dispatch() called at [vendor\magento\framework\Interception\Interceptor.php:58] #17 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor\magento\framework\Interception\Interceptor.php:138] #18 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor\magento\framework\Interception\Interceptor.php:153] #19 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated\code\Magento\Framework\App\FrontController\Interceptor.php:23] #20 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor\magento\framework\App\Http.php:116] #21 Magento\Framework\App\Http->launch() called at [generated\code\Magento\Framework\App\Http\Interceptor.php:23] #22 Magento\Framework\App\Http\Interceptor->launch() called at [vendor\magento\framework\App\Bootstrap.php:263] #23 Magento\Framework\App\Bootstrap->run() called at [index.php:29]
This is just for a very simple admin module I'm trying to create following a Magento 2 tutorial.
This is the structure for the module:
acl.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceShcemaLocation="urn:magento:framework:Acl/etc/acl.xsd">
<acl>
<resources>
<resource id="Magento_Backend::admin">
<resource id="Magento_Backend::marketing">
<resource
id="Dshop_ModuloBasico::dshopbackend"
title="DshopBackend" sortOrder="60">
<resource id="Dshop_ModuloBasico::index" title="DshopBackend index" />
</resource>
</resource>
</resource>
</resources>
</acl>
</config>
Index.php
<?php
namespace Dshop\ModuloBasico\Controller\Adminhtml\Index;
use Magento\Backend\App\Action\Context;
use Magento\Framework\View\Result\PageFactory;
class Index extends \Magento\Backend\App\Action
{
protected $resultPageFactory;
public function __construct(
Context $context,
PageFactory $resultPageFactory
){
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
}
public function execute()
{
$resultPage = $this->resultPageFactory->create();
return $resultPage;
}
public function _isAllowed()
{
return $this->_authorization->isAllowed('Dshop_ModuloBasico::index');
}
}
menu.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
<menu>
<add
id="Dshop_ModuloBasico::dshopbackend"
title="DshopBackend"
module="Dshop_ModuloBasico"
sortOrder="50"
parent="Magento_Backend::marketing"
resource="Dshop_ModuloBasico::dshopbackend"
/>
<add
id="Dshop_ModuloBasico::index"
title="DshopBackend Index"
module="Dshop_ModuloBasico"
sortOrder="51"
parent="Dshop_ModuloBasico::dshopbackend"
action="dshopadmin/index/"
resource="Dshop_ModuloBasico::index"
/>
</menu>
</config>
routes.xml
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="admin">
<route id="dshopadmin" frontName="dshopadmin">
<module name="Dshop_ModuloBasico" before="Magento_Backend" />
</route>
</router>
</config>
module.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Dshop_ModuloBasico" setup_version="1.0.0"></module>
</config>
registration.php
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Dshop_ModuloBasico',
__DIR__
);
No idea what I'm doing wrong here.
Any help would be appreciated!
Best Answer
You have a typo in acl.xml file: noNamespaceShcemaLocation should be changed to noNamespaceSchemaLocation
So finally your acl.xml file will looks like this: