4

I migrated the database of magento 1.9.x website to magento 2 using the data-migration-tool. After migrating the database the products and categories are displayed at the backend. Now when I cleared my cache am getting an error like

There has been an error processing your request Exception printing is disabled by default for security reasons. Error log record number: 1863159107

in both frontend and backend. This error is happening for even a small change made at backend or frontend(clearing cache, redindexing) and when I run the command php magento setup:static-content:deploy Its getting error like more than one default website is defined. Someone please help me regarding this issue. The error in 1863159107 is

 a:4:{i:0;s:40:"More than one default website is defined";i:1;s:2115:"#0   C:\xampp\htdocs\mage2.0.4\vendor\magento\module- store\Model\StoreResolver\Website.php(46):  Magento\Store\Model\WebsiteRepository->getDefault()
#1 C:\xampp\htdocs\mage2.0.4\vendor\magento\module-store\Model\StoreResolver.php(130): Magento\Store\Model\StoreResolver\Website->getAllowedStoreIds(NULL)
#2 C:\xampp\htdocs\mage2.0.4\vendor\magento\module-store\Model\StoreResolver.php(116): Magento\Store\Model\StoreResolver->readStoresData()
#3 C:\xampp\htdocs\mage2.0.4\vendor\magento\module-store\Model\StoreResolver.php(85): Magento\Store\Model\StoreResolver->getStoresData()
#4 C:\xampp\htdocs\mage2.0.4\vendor\magento\module-store\Model\StoreManager.php(151): Magento\Store\Model\StoreResolver->getCurrentStoreId()
#5 C:\xampp\htdocs\mage2.0.4\vendor\magento\module-store\App\Request\PathInfoProcessor.php(39): Magento\Store\Model\StoreManager->getStore('')
#6 C:\xampp\htdocs\mage2.0.4\vendor\magento\module-backend\App\Request\PathInfoProcessor.php(47): Magento\Store\App\Request\PathInfoProcessor->process(Object(Magento\Framework\App\Request\Http), '/')
#7 C:\xampp\htdocs\mage2.0.4\var\generation\Magento\Backend\App\Request\PathInfoProcessor\Proxy.php(95): Magento\Backend\App\Request\PathInfoProcessor->process(Object(Magento\Framework\App\Request\Http), '/')
#8 C:\xampp\htdocs\mage2.0.4\vendor\magento\framework\App\Request\Http.php(161): Magento\Backend\App\Request\PathInfoProcessor\Proxy->process(Object(Magento\Framework\App\Request\Http), '/')
#9 C:\xampp\htdocs\mage2.0.4\vendor\magento\framework\HTTP\PhpEnvironment\Request.php(194): Magento\Framework\App\Request\Http->setPathInfo()
#10 C:\xampp\htdocs\mage2.0.4\vendor\magento\framework\App\Request\Http.php(204): Magento\Framework\HTTP\PhpEnvironment\Request->getPathInfo()
#11 C:\xampp\htdocs\mage2.0.4\vendor\magento\framework\App\Http.php(110): Magento\Framework\App\Request\Http->getFrontName()
#12 C:\xampp\htdocs\mage2.0.4\vendor\magento\framework\App\Bootstrap.php(258): Magento\Framework\App\Http->launch()
#13 C:\xampp\htdocs\mage2.0.4\index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))
#14 {main}";s:3:"url";s:11:"/mage2.0.4/";s:11:"script_name";s:20:"/mage2.0.4/index.php";}

Not only this issue, In magento 2 when I try to change some style in frontend,the styles are getting lost and page is displayed like below enter image description here

why is this happening?

3
  • Please check your browser console for any error Apr 8, 2016 at 9:40
  • What's the content of the var/report/1863159107 file ? Apr 8, 2016 at 9:41
  • I have edited my question. Kindly see it.
    – Ramya
    Apr 8, 2016 at 9:52

1 Answer 1

3

I ran into this same error on a multi-website project and it seems if you change the default website's name to anything other than Main Website, Magento creates a new store record, but keeps the old one!

The exception is thrown in this file ./vendor/magento/module-store/Model/WebsiteRepository.php

private function initDefaultWebsite()
{
    $websites = (array) $this->getAppConfig()->get('scopes', 'websites', []);
    foreach ($websites as $data) {
        if (isset($data['is_default']) && $data['is_default'] == 1) {
            if ($this->default) {
                throw new \DomainException(__('More than one default website is defined'));
            }
    // ...

Dumping out the contents of $websites I found

Array
(
    [admin] => Array
        (
            [website_id] => 0
            [code] => admin
            [name] => Admin
            [sort_order] => 0
            [default_group_id] => 0
            [is_default] => 0
        )

    [base] => Array
        (
            [website_id] => 1
            [code] => base
            [name] => Main Website
            [sort_order] => 0
            [default_group_id] => 1
            [is_default] => 1
        )

    [wholesale] => Array
        (
            [website_id] => 2
            [code] => wholesale
            [name] => Wholesale
            [sort_order] => 2
            [default_group_id] => 2
            [is_default] => 0
        )

    [retail] => Array
        (
            [website_id] => 1
            [code] => retail
            [name] => Retail
            [sort_order] => 0
            [default_group_id] => 1
            [is_default] => 1
        )

)

Notice, base and retail both have is_default set... Changing the name of the default website back to Main Website seems to have fixed the problem as the last record went away when doing so.

In conclusion, the Main Website is magical and should not be renamed from what I can tell.

6
  • I'm running into this same issue. Can you tell me where the name of the default website needs to be set/changed?
    – Mark Biek
    Apr 4, 2017 at 20:43
  • @MarkBiek Under Stores -> All Stores, then click the name of the default website if it isn't currently named 'Default Website' and change it to 'Default Website'. Apr 4, 2017 at 20:45
  • Unfortunately, this error is preventing me from even getting into the admin. Is it possible to do it from the command-line (or directly in the database)?
    – Mark Biek
    Apr 4, 2017 at 20:47
  • 1
    Found it! I needed to make the change in app/etc/config.local.php.
    – Mark Biek
    Apr 4, 2017 at 20:50
  • ahh, so that's how you can change the name of the default website - nice find! Apr 4, 2017 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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