Error: "Object DOMDocument should be created." When add/edit product attributes

Another possible reason for the Object DOMDocument should be created. error is the unaccessible ui_component/your_listing.xml file under the view/adminhtml/ folder when you want to create an Adminhtml Grid and you declare it under the view/adminhtml/layout/your_handle_index.xml as this:

<body>
    <referenceContainer name="content">
        <uiComponent name="your_listing"/>
    </referenceContainer>
</body>

Another possible reason for this error is if your class folders don't have proper capitalization (i.e. are lowercase).

var/log/system.log:

[2016-02-26 21:19:51] main.CRITICAL: Class Example\Myclass\Block\ShopCategory does not exist [] []
[2016-02-26 21:19:51] main.CRITICAL: Invalid block type: Example\Myclass\Block\ShopCategory [] []

For example, if the namespace folder is "example" rather than "Example" it will work just fine on Windows and most Mac installations, but will fail with the "Object DOMDocument should be created." error on Linux, as Linux uses a case-sensitive filesystem.


Looks like var/generation is not writable. Make sure to set proper file system ownership and permissions: var, app/etc and pub/static should be writable by web server.