Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
FileSyncClient
June 18, 2016
11:55, EEST
Avatar
kevinsaner
Member
Members
Forum Posts: 7
Member Since:
June 18, 2016
sp_UserOfflineSmall Offline

Hi
I’m currently evaluating the usage of OPC UA Java SDK for a project. However, my client wishes to have synchronized folders, but I’m struggling to set them up. I guess my main problem is to get the NodeId of the Folder I wanna synchronize. Following is the error I get:

06/18/2016 10:32:04.852 WARN Failed to synchronize folder ns=5;s=C:/Users/Kevin/Desktop/Folder from server https://Notebook.home:52443/OPCUA/OPC_UA_Server
java.lang.NullPointerException
at com.prosysopc.ua.client.FileSyncClient.sync(Unknown Source)
at com.prosysopc.ua.client.FileSyncClient$1.run(Unknown Source)
at java.util.TimerThread.mainLoop(Unknown Source)
at java.util.TimerThread.run(Unknown Source)

And this is what I’ve tried so far:

NodeId nodeId = new NodeId(5, “C:/Users/Kevin/Desktop/Folder”);
FileSyncClient FileSync = new FileSyncClient(client);
FileSync.addSyncedFolder(nodeId, “C:/Users/Kevin/Desktop/Client_Folder”, FileSyncClient.SyncFolderDirection.ReadWrite);
FileSync.setMonitorInterval(8);

This is what I get when I browse the address as the ID of my folder:

Current Node: Folder: FolderType (ID: ns=5;s=C:\Users\Kevin\Desktop\Folder)

June 20, 2016
10:08, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1026
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Unfortunately, the FileSyncClient is not very thoroughly tested and does not provide too clear error reporting, so it is difficult to say the exact reason for this.

The first thing that comes to mind is that your NodeIDs look a bit different: the server uses ‘\’ whereas your client is using “/”.

Also, try first to synchronize ReadOnly.

June 20, 2016
13:27, EEST
Avatar
kevinsaner
Member
Members
Forum Posts: 7
Member Since:
June 18, 2016
sp_UserOfflineSmall Offline

When I change the / to \ I get an invalid escape sequence. Also to synchronize ReadOnly didn’t work.

When I do it like this though, it works. It synchronizes all my folders, but I get an awful lot of exceptions from folders the client can’t synchronzie.

The code:
NodeId nodeId = new NodeId(0,””);
nodeId = Identifiers.ObjectsFolder;
print(nodeId.parseNodeId(nodeId.toString()).toString());
UaNode prevNode;
try {
prevNode = client.getAddressSpace().getNode(nodeId);
if(prevNode == null){
print(“Was Null”);
}
else{
print(prevNode.toString());
}
} catch (ServiceException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (AddressSpaceException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

FileSyncClient FileSync = new FileSyncClient(client);
try {
FileSync.addSyncedFolder(nodeId, “C:/Users/Kevin/Desktop/Client_Folder”, FileSyncClient.SyncFolderDirection.ReadOnly);
} catch (Exception e) {
e.printStackTrace();
}
FileSync.setMonitorInterval(1000);

The Exceptions:

Caused by: ServiceFault: Bad_InternalError (0x80020000) “An internal error occurred as a result of a programming or configuration error.”
Diagnostic Info: ServiceFault: Bad_InternalError (0x80020000) “An internal error occurred as a result of a programming or configuration error.”
Diagnostic Info: java.lang.NullPointerException
at com.prosysopc.ua.server.compliance.NonUaNodeComplianceNodeManager$NonUaNodeIoManager.readNonValue(Unknown Source)
at com.prosysopc.ua.server.IoManager.readAttribute(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.readAttribute(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.readAttribute(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.read(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.onRead(Unknown Source)
at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition$1.serve(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition.serve(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerSecureChannel.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection$4.onMessageComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.fireComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.setMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

at org.opcfoundation.ua.application.ServiceHandlerComposition$1.serve(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition.serve(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerSecureChannel.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection$4.onMessageComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.fireComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.setMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

Have you any idea how to get rid of these exceptions?

June 20, 2016
14:32, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

This is because you are using Identifiers.ObjectsFolder. It is an FolderType instance, but an instance of OPC UA FolderType is not the same thing as a filesystem directory. Identifiers.ObjectsFolder is one of the standard FolderType instances that are used to describe the standard structure of the address space. You should use a NodeId that means a (filesystem) directory instead.

The current (released) version of the SDK is made for the spec version 1.02, therefore see https://opcfoundation.org/developer-tools/specifications-unified-architecture/part-5-information-model/ part Annex C (select archive and 1.02 version) and note that it doesn’t specify anything about filesystem folders.

I have to thank you because now I did notice that in the version 1.03 of the spec there is a new type specified in that Annex C: FileDirectoryType. In 1.02 there was not anything specified about (filesystem) folders, so we sort of extended the use of the standard FolderType for that purposes.

We need to change this for the SDK version that supports 1.03 which on the current roadmap is in 2.3.0. Until that time you should consult server documentation if a FolderType instance should be interpreted as a filesystem folder (assuming others have made the same assumption to model directory folders with FolderType). Note that I do not know any OPC UA server that would that would have an entire folder (except our SampleConsoleServer, see SampleConsoleServer.createFileNodeManager). Usually it would be a single FileType instance for e.g. writing a config file to a device or such.

– Bjarne

June 20, 2016
15:43, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

“When I change the / to \ I get an invalid escape sequence. Also to synchronize ReadOnly didn’t work”
Note that in Java \ is used to escape special characters, you need to use \\ instead to get the actual \ character.

June 20, 2016
16:16, EEST
Avatar
kevinsaner
Member
Members
Forum Posts: 7
Member Since:
June 18, 2016
sp_UserOfflineSmall Offline

Thank you very much, that was an outstanding hint with the \\. My problem is solved now.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
27 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 737

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6450

Newest Members:

fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1