1

I m running Magento2.3 and getting below error.

How can I find where exactly error in file. which XML is causing the issue?

Please, can anyone guide me on this? This is very confusing to solve

    1 exception(s):
Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'class': The attribute 'class' is not allowed.
Line: 972


Exception #0 (Magento\Framework\Config\Dom\ValidationException): Element 'referenceBlock', attribute 'class': The attribute 'class' is not allowed.
Line: 972

#0 /home/ukprinting/public_html/vendor/magento/framework/Config/Dom.php(117): Magento\Framework\Config\Dom->_initDom('<layout xmlns:x...')
#1 /home/ukprinting/public_html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(116): Magento\Framework\Config\Dom->__construct('<layout xmlns:x...', Object(Magento\Framework\App\Arguments\ValidationState), Array, NULL, '/home/ukprintin...', '%message%\nLine:...')
#2 /home/ukprinting/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#3 /home/ukprinting/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#4 /home/ukprinting/public_html/vendor/magento/framework/Config/DomFactory.php(43): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array)
#5 /home/ukprinting/public_html/vendor/magento/framework/View/Model/Layout/Update/Validator.php(141): Magento\Framework\Config\DomFactory->createDom(Array)
#6 /home/ukprinting/public_html/vendor/magento/framework/View/Model/Layout/Merge.php(476): Magento\Framework\View\Model\Layout\Update\Validator->isValid('<layout xmlns:x...', 'layout_merged', false)
#7 /home/ukprinting/public_html/vendor/magento/framework/View/Model/Layout/Merge.php(457): Magento\Framework\View\Model\Layout\Merge->_validateMergedLayout('LAYOUT_frontend...', '<!--\r\n    <refe...')
#8 /home/ukprinting/public_html/generated/code/Magento/Framework/View/Model/Layout/Merge/Interceptor.php(193): Magento\Framework\View\Model\Layout\Merge->load(Array)
#9 /home/ukprinting/public_html/vendor/magento/framework/View/Layout/Builder.php(86): Magento\Framework\View\Model\Layout\Merge\Interceptor->load()
#10 /home/ukprinting/public_html/vendor/magento/framework/View/Layout/Builder.php(63): Magento\Framework\View\Layout\Builder->loadLayoutUpdates()
#11 /home/ukprinting/public_html/vendor/magento/framework/View/Layout.php(253): Magento\Framework\View\Layout\Builder->build()
#12 /home/ukprinting/public_html/vendor/magento/framework/View/Layout.php(875): Magento\Framework\View\Layout->build()
#13 /home/ukprinting/public_html/generated/code/Magento/Framework/View/Layout/Interceptor.php(414): Magento\Framework\View\Layout->getBlock('page_content_he...')
#14 /home/ukprinting/public_html/vendor/magento/module-cms/Helper/Page.php(171): Magento\Framework\View\Layout\Interceptor->getBlock('page_content_he...')
#15 /home/ukprinting/public_html/vendor/magento/module-cms/Controller/Index/Index.php(74): Magento\Cms\Helper\Page->prepareResultPage(Object(Magento\Cms\Controller\Index\Index\Interceptor), 'home')
#16 /home/ukprinting/public_html/generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(24): Magento\Cms\Controller\Index\Index->execute(NULL)
#17 /home/ukprinting/public_html/vendor/magento/framework/App/Action/Action.php(108): Magento\Cms\Controller\Index\Index\Interceptor->execute()
#18 /home/ukprinting/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#19 /home/ukprinting/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Cms\Controller\Index\Index\Interceptor->___callParent('dispatch', Array)
#20 /home/ukprinting/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#21 /home/ukprinting/public_html/generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php(39): Magento\Cms\Controller\Index\Index\Interceptor->___callPlugins('dispatch', Array, Array)
#22 /home/ukprinting/public_html/vendor/magento/framework/App/FrontController.php(159): Magento\Cms\Controller\Index\Index\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#23 /home/ukprinting/public_html/vendor/magento/framework/App/FrontController.php(99): Magento\Framework\App\FrontController->processRequest(Object(Magento\Framework\App\Request\Http), Object(Magento\Cms\Controller\Index\Index\Interceptor))
#24 /home/ukprinting/public_html/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#25 /home/ukprinting/public_html/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#26 /home/ukprinting/public_html/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#27 /home/ukprinting/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#28 /home/ukprinting/public_html/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(69): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#29 /home/ukprinting/public_html/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#30 /home/ukprinting/public_html/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#31 /home/ukprinting/public_html/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, NULL)
#32 /home/ukprinting/public_html/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#33 /home/ukprinting/public_html/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#34 /home/ukprinting/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http\Interceptor->launch()
#35 /home/ukprinting/public_html/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#36 {main}
3
  • Respective to the page you can find an xml and remove the class attribute which is not allowed in the latest version May 15, 2019 at 11:02
  • This is probably an issue in one of your xml files as you can not use class on referenceBlock. Please check your theme. May 15, 2019 at 11:04
  • one of file that is the issue how i can find? Should i check each and every xml file its not make sense
    – MageLerner
    May 15, 2019 at 11:16

2 Answers 2

2

In case you are using the PhpStorm you can build a custom inspection which can find this and another xml errors almost automatically.

1) Generate urn for PHPStorm using Magento's built-in command bin/magento dev:urn-catalog:generate. Note: if you generate it on the deployment server you should copy the .idea/misc.xml file manually to your local project.

2) Create new code inspection in PHPStorm:

  • Open context menu

    Open context menu

  • Open inspection preferences

    Open inspection preferences

  • Create new xml inspection using the gear icon

    Create new xml inspection using the gear icon

  • Hit the Ok to run inspection

  • Check result

    Check result

PS: you can run this inspection to the overall project or to the selected directories/files.

0

It will be an extension or theme you have added. Does the store have many extensions installed?

Search for referenceBlock

Then you've got to work through the results and see where class= has been used

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.