Skip to main content
1-Visitor
July 18, 2016
Solved

Limit in number of users creating from an extension

  • July 18, 2016
  • 2 replies
  • 2767 views

Hey Geeks,

I was trying to create a set of users, from an custom extension created by me.

Inside a loop, I need to create n number of users.

Please see the code snippet;

for(int k=0; k < 3 ; k++) {

  String userName = "testUser" + k;

  services.CreateUser(userName, "Test Desc", null, "pwd");

}

The first user(testUser0) was created successfully in the first iteration.

But in next iterations testUser1 and testUser2 are not created in Thingworx.

The exception I am getting is ;


com.thingworx.common.exceptions.InvalidRequestException: User limit reached; Please Upgrade to Paid Version

        at com.thingworx.system.managers.BaseManager.createEntity(BaseManager.java:211)

        at com.thingworx.contentmanagement.ImportProcessor.processImport(ImportProcessor.java:456)

        at com.thingworx.resources.entities.EntityServices.processImport(EntityServices.java:130)

        at com.thingworx.resources.entities.EntityServices.CreateUser(EntityServices.java:395)

        at com.test.CtsServiceThingTemplate.reloadPicassoDetails(CtsServiceThingTemplate.java:56)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:498)

        at com.thingworx.common.processors.ReflectionProcessor.processService(ReflectionProcessor.java:170)

        at com.thingworx.handlers.ReflectionServiceHandler.processService(ReflectionServiceHandler.java:45)

        at com.thingworx.things.async.AsyncHandler.run(AsyncHandler.java:42)

        at java.lang.Thread.run(Thread.java:745)

Can anyone help on this?

Best answer by CarlesColl

Hi Sujith,

The messages states that you reached the user limit, that you should go for the paid version.

Carles.

2 replies

1-Visitor
July 18, 2016

Hi Sujith,

The messages states that you reached the user limit, that you should go for the paid version.

Carles.

ses1-VisitorAuthor
1-Visitor
July 19, 2016

Hi Carles,

Thanks for your reply.

But I do have only 3 users created so far, and each time when I run the code I could create one more user.

ie. the new user is created in every first iteration only at the time of the for-loop execution.

With the below code, I can create n number of users in TW.

services.CreateUser(userName, "Test Desc", null, "pwd");

Issue is only when I am using this code inside a for-loop.

Thanks,

Sujith

5-Regular Member
July 19, 2016

Whatever server you are using is not a paid version and this is how we are limiting you from creating more users than allowed.

Meghan

5-Regular Member
July 19, 2016

Where is your ThingWorx instance hosted? Is this in a tutorial on the Developer Zone?

ses1-VisitorAuthor
1-Visitor
July 20, 2016

ThingWorx instance is hosted in DeveloperZone only

5-Regular Member
July 21, 2016

Ah, yes, so programmatic creation of users is disabled in Developer Zone instances, and that explains the error you are seeing. Sorry for the inconvenience there!

If/when you decide to buy the paid version, this will not be an issue anymore.

Hope this helps!

Tori