HTTP Status 500 – Cannot find CMSSite associated with current URL

This is the first error we see, when we set up Hybris and hit http://localhost:9001/

Hybris supports multi sites for a single code base, which can be accessed by passing a request parameter while accessing the site for first time. This parameter is set in browser session for subsequent requests.


When you pass the parameter site, with value same as your CMS site id, you are able to see the home page.

If you are using a single storefront, then you need to tell hybris specifically, by configuring the URL patterns for your site, so that hybris knows, what site you are looking for, when hit without a parameter. This can be dine in site.impex

UPDATE CMSSite;uid[unique=true];urlPatterns;defaultlanguage(isocode)


Why hybris deprecated tenant scope?

To understand, the meaning of tenant scope, see my previous post on scopes in hybris. With version 5.0 , hybris decided to deprecate tenant scope.

In verion 5, Hybris has tenant specific application contexts. So the bean you will get will be singleton by default, which is already limited to a tenant. So there is no need to have a different scope called tenant.




As you can see fro above picture, each tenant creates its own set of application context, so now tenant scope is redundant.

Source : Hybris Wiki

What are different scopes in Hybris?

The scope can be defined as a virtual space, situation or time line, under which a particular activity is valid or possible. In terms of Hybris, the scope is the time for which a bean is available for performing business logic.

In addition to Spring scopes, Hybris has defined below scopes.

1) Tenant : This is equivalent  to singleton scope of spring. The only difference is that here Hybris limit the instance of bean in question to a particular tenant.

Hybris has deprecated this scope in version 5.0.

2) yrequest : This scope is equivalent to request scope. But this is used out side the web application context. It means that you can access these beans even in absence of a web application. These are basically used in back end processes, where we don’t want to expose our services on web, but still want to use them from outside of our project.

Once a session is invalidated, the scope ceases to exist, and instances are destroyed.