4

In v 4.6.0, we cannot delete tenats through the UI, only disable. However, I see there is a deleteTenant method on the TenantMgtAdminService soap service.

I have tried to call this service, but I get an error. From the logs, it has:

{org.wso2.carbon.tenant.mgt.services.TenantMgtAdminService} - Error deleting tenant with domain: test7.tenant and tenant id: 136. {org.wso2.carbon.tenant.mgt.services.TenantMgtAdminService} 
java.lang.NullPointerException 
at org.wso2.carbon.tenant.mgt.services.TenantMgtAdminService.deleteTenant(TenantMgtAdminService.java:520) 

Looking at the source code, I think this might be a defect as the null pointer exception seems to be caused by trying to access a "billing service" around line 520.

So I wonder if I could configured my tenant in a way that this billing service would not be null, or of there is some other workaround?

Thanks

Community
  • 1
  • 1
Ouananiche
  • 579
  • 5
  • 12
  • I've found that the deleteTenant method on the RemoteTenantManagerService actually works. It seems to delete the tenant...but trying to add the tenant again with the same domain causes the message "Domain is not available for registration". I am trying to create a script that will create a set of tenants,users, roles, etc. for testing, deleting the tenants first if they exist. Any help on the domain not available issue? – Ouananiche May 08 '14 at 20:15

2 Answers2

5

Use deleteTenant operation in the RemoteTenantManagerService and restart the server. ;) Restarting the server will clear the cache and allow you to add new tenants with the same domain name.

Amal
  • 61
  • 2
0

Deleting a tenant is not a good option despite having that admin service. Tenancy architecture is so complicated, that even the admin service couldn't guarantee a complete cleanup. Even after a successful response from the admin service there could be tenant data left in the database.

These remains depend on the functionality you are using in the server. That's why this service call seems a success for some whereas it fails some. Things could get worse if you decide to use the same tenant name moving forward.

Best thing is to deactivate the tenant. This blocks you from using the same tenant name in the future but with a guarantee of consistent tenant data.

Nipun Thathsara
  • 1,119
  • 11
  • 20