What is role of jalosession?

The Jalo layer in hybris is depreacted, not the jalosession.

Whenever a request is made to hybris server, it may need current user details, currency, language, timezone etc to serve that request efficiently. Since HttpSession does not hold all these details, hybris came up with the concept of JaloSession.

Whenever a request comes to Hybris, the filter HybrisInitFilter creates an object of JaloSession. Every JaloSession object is associated with a SessionContext object, which has current user, language, currency etc and the current httpSession object.

  • Cron jobs also run in a JaloSession.
  • Each JaloSession is bound to a tenant. This cannot be changed, after the instance of JaloSession is created.
  • JaloSession is never made persistent in database.

How to split an order into multiple consignment

While fulfilling an order, some time it is necessary for business to split the order into multiple orders.

For instance, a customer orders two items A and B, now A has delivery window of 2 days, while B can be delivered in minimum 5 days. Now business has the option to either ship both items in 5 days. But what if item A is fresh, and will get destroyed in 5 days. There may be a case, where customer wants a mandatory delivery of item A within 2 days. In such situations, if business house doesn’t want to loose customer, it has no choice but to split order and ship it multiple times. This is the case of split consignment.

Now there may be various conditions, which may call for splitting the order into multiple consignments. Above example is just one of them. For example, we may want to split consignment, based on warehouse from where item will be picked up. We may want to split consignment, based on product type (fresh or ambient) etc. These situations which decides the business logic to be a case for splitting the consignments, are known as splitting strategies. We can have as many as strategy to split, as we want.

By default, hybris creates only one consignment for an order. This is done by following service.


As you can see, that the orderSplittingService accepts a list of strategies, we can create many strategies, and split our order. The actual business logic for splitting will go into strategy class.

How to customize error message in store front

Unexpected conditions is something, which is unavoidable in any application. So is Hybris store front. There may be hundreds of situations, where you would like to show an error message to users. The error could be because of, wrong user input, unavailability of data, inadequate exception handling or some thing else. But the bottom line is, it is unavoidable.

Hybris provides a very flexible and modular approach to show error messages. But your customer may still want to customize the way we show error messages in store front.

GlobalMessages class

While serving a particular request in your java classes (controllers, facades, service, dao etc), whenever you come across a error situation (like validation error or a possible null pointer etc), you should use this class. This class provides static methods to add error messages to your model object.

There are different type of messages, you can add to your model. They include confirmation message, error or warning messages.




This tag is used to actually render the error message at a particular position and some css. Now you can customize the csss as you want.


The error messages, are present in base properties. If you want to add a new type of error message to your store front, you should do that in Global message class.

Why we have converters and populators in hybris?

I can convert my models to DTO directly in facade layer. Then why should i have a converter?

Its Simple. We may need to convert a product (model) from multiple places. We convert it on product listing page, product detail page, order confirmation page etc. Hybris follows oops concept..So it is good to have a separate class to do this conversion for us, from all of these places.

Converters creates an object of DTO. While populators breaks the code for filling up data in DTO. This is required because, not each DTO needs all attributes of a model. Thus by having multiple populators, we can write more efficient code. Reverse populators are used to fill data in model from DTOs.


The image shows two paths followed (a and b) by two different facades using same converter and different poplators.

We should always use spring injected converters and  populators.

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.