Jalo session in Hybris

In normal web applications, we will have HTTP session to manage the user session

In Hybris, in addition to this HTTP Session, we also have Jalo session

Jalo session basically wraps us the data about currently logged in User and their settings

It is used as a base context using which user requests will be processed.

Every request to hybris application is associated with Jalo session


Whenever a request is made 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.

Whenever Jalosession is instantiated SessionContext is pre-set with system defaults values.

  1. JaloSession session = JaloSession.getCurrentSession()
JaloSession session = JaloSession.getCurrentSession()

This method will return the currently active JaloSession or create a new JaloSession if none is currently active

How to close Jalo Session ?

We can specify the timeout or we can manually close it

default.session.timeout property already set by hybris in project.properties where Jalo session expires after the seconds specified in this property automatically.

We can also specify expiration time explicitly as below

  1. JaloSession.getCurrentSession().setTimeout( 10 ); //Timeout after ten seconds:
  2. JaloSession.getCurrentSession().setTimeout( -1 );// No timeout:
JaloSession.getCurrentSession().setTimeout( 10 ); //Timeout after ten seconds:
JaloSession.getCurrentSession().setTimeout( -1 );// No timeout:

We can manually close it as below

  1. JaloSession.getCurrentSession().close();

Why do we need JaloSession when we already have HttpSession ?

Whenever a request is made to hybris application, it always requires current user details, currency, language, timezone etc to serve that request in a more appropriate way.

Since HttpSession does not hold all these details, hybris is using the concept of JaloSession to store these required values and use them in the application.

Note :

The hybris Suite will not allow users or CronJobs to use closed JaloSessions. If a user tries to log into the hybris Suite (shop application, hMC, etc), the hybris Suite will create a new JaloSession for the login process.

JaloSessions are bound to the tenant at instantiation, you can’t use one single JaloSession across a multi-tenant system (that is, using one single JaloSession to manage multiple tenants is not possible). Instead, you will have to use at least one JaloSession per tenant.

About the Author

Founder of javainsimpleway.com
I love Java and open source technologies and very much passionate about software development.
I like to share my knowledge with others especially on technology 🙂
I have given all the examples as simple as possible to understand for the beginners.
All the code posted on my blog is developed,compiled and tested in my development environment.
If you find any mistakes or bugs, Please drop an email to kb.knowledge.sharing@gmail.com

Connect with me on Facebook for more updates

Share this article on