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

Not authorized for Property Write in thingworx

keles0glu
5-Regular Member

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
14-Alexandrite
(To:keles0glu)

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

keles0glu
5-Regular Member
(To:geva)

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

Announcements