Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
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?
Solved! Go to Solution.
Hi Sujith,
The messages states that you reached the user limit, that you should go for the paid version.
Carles.
Hi Sujith,
The messages states that you reached the user limit, that you should go for the paid version.
Carles.
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
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
Thanks Meghan and Tori, for the reply.
Where is your ThingWorx instance hosted? Is this in a tutorial on the Developer Zone?
ThingWorx instance is hosted in DeveloperZone only
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