I am getting this error from the provided ExampleServer
when I write a value to a variable (using UaExpert), which is a child of another object. I printed the access level where the exception is thrown, and it seems CurrentWrite access is removed as you can see in the stack trace below. Can someone help?
Variable config:
UaVariableNode foo = UaVariableNode.builder(server.getNodeMap())
.setNodeId(new NodeId(namespaceIndex, "ObjectTypes/MyObjectType.Foo"))
.setAccessLevel(ubyte(AccessLevel.getMask(AccessLevel.READ_WRITE)))
.setBrowseName(new QualifiedName(namespaceIndex, "Foo"))
.setDisplayName(LocalizedText.english("Foo"))
.setDataType(Identifiers.Int16)
.setTypeDefinition(Identifiers.BaseDataVariableType)
.build();
Stacktrace:
// System.out.println(""+node.getDisplayName()+" "+accessLevels); prints:
LocalizedText{text=Foo, locale=en} [CurrentRead]
// Rest of the stack trace
10:16:24.096 [ua-shared-pool-8] ERROR o.e.m.e.server.ExampleNamespace - Unable to write value=DataValue{value=Variant{value=1}, status=StatusCode{name=Good, value=0x00000000, quality=good}, sourceTime=DateTime{utcTime=0, javaDate=Mon Jan 01 08:00:00 SGT 1601}, serverTime=DateTime{utcTime=0, javaDate=Mon Jan 01 08:00:00 SGT 1601}}
org.eclipse.milo.opcua.stack.core.UaException: status=Bad_NotWritable, description=The access level does not allow writing to the Node.
at org.eclipse.milo.opcua.sdk.server.util.AttributeWriter.writeAttribute(AttributeWriter.java:72)
at org.eclipse.milo.opcua.sdk.server.nodes.ServerNode.writeAttribute(ServerNode.java:174)
at org.eclipse.milo.opcua.sdk.server.nodes.ServerNode.writeAttribute(ServerNode.java:153)
at org.eclipse.milo.examples.server.ExampleNamespace.write(ExampleNamespace.java:793)
at org.eclipse.milo.opcua.sdk.server.services.AttributeServices.lambda$8(AttributeServices.java:199)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)