Skip to Content
2
Former Member
Oct 17, 2017 at 05:48 PM

Switching tenant depending on the url

439 Views

Hi all,

I have two websites in one storefront and each one in a tenant.

customStoreFront:

  • website 1 => tenant master

  • website 2 => tenant slave1

I want to access each website with a different url, like :

www.company1 .com and www.company2.com.

The webroot of the storefront is the same for each website : /

 customstorefront.webroot=/


The problem is that, when I request www.company2.com I have a cms site not found exception because I am on the master tenant instead of slave1.

Should I use something like a DataSourceSwitchingFilter or a TenantActivationFilter to request the desired tenant?

For now I have an exception like

 java.lang.IllegalStateException: ###############################################################
 Given current tenant is <<company2>>[1091343644] but returned servlet context related web context (Root WebApplicationContext - : startup date [Tue Oct 17 15:00:58 CEST 2017]; parent: hybris Application context - master) is attached to other tenant master
 ###############################################################


When I try to change the current tenant.

Any help on this?