cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X

Not authorized for Property Write in thingworx

keles0glu
6-Contributor

Not authorized for Property Write in thingworx

I am trying run a thread in a function.This function gets the data coming from the socket and assing this data into thinking property.But I get 'Not authorized for Property Write in thingworx'.I looked at the thingworx extension API Doc. But I did not find any examples about this ThreadLocalContext.Where do I make mistakes

 

public void startThread() {

		Thread t = new Thread(() -> {
			String line = "";
			try {
				SecurityContext systemContext = SecurityContext.createSystemUserContext();
				ThreadLocalContext.setSecurityContext(systemContext);
				Thing thing = ThingUtilities.findThing("AEOSEvents");
				ThreadLocalContext.clearSecurityContext();

				while ((line = reader.readLine()) != null) {
                                   thing.setPropertyValue("rawEvents", new StringPrimitive(line));
			}

				}
			} catch (IOException e) {
				e.printStackTrace();
			} catch (Exception e) {
				e.printStackTrace();
			}
		});
		t.start();

	}

 

2 REPLIES 2
geva
15-Moonstone
(To:keles0glu)

Have you checked that the permissions for the AEOSEvents Thing allow the system user to write to this rawEvents property?

keles0glu
6-Contributor
(To:geva)

Yes. I have checked.Not only about permission.But i did it.I have to use TransactionFactory for multithread in thingworx.

Announcements


Top Tags