Topic RSS9:39, EEST
September 9, 2025
OfflineWe are using Prosys OPC UA SDK for Java 5.3.0-181 (Client+Server binary) and the Codegen tool to generate Java classes from a NodeSet2 XML model.
When running the generator, it fails with the following error: (The issue occurs both with Java 21 and Java 8, so it does not appear to be related to the Java version.)
ERROR Error while parsing method arguments java.lang.NullPointerException: Cannot invoke “org.w3c.dom.Element.getLocalName()” because “” is null at com.prosysopc.ua.codegen2.a.f.a(SourceFile:457)
Questions:
– Is this a known issue in Codegen 5.3.0-181?
– Could you provide guidance on how to trace which Method node is causing the NPE, or if there is a fix/workaround available?
13:36, EEST
April 3, 2012
OfflineHi,
Skipping over some details, but I think in this case it isn’t actually about Methods, but the error happens when we check for the arguments for methods, which due to technical internal design happens for all variables that have a Value tag.
It is quite likely, that you have
OR
<Value></Value>
in one or more of the UAVariable definitions (since I can reproduce the issue by editing a nodeset to be like this). IF that is the case, if you remove those empty Value tags it should work. IF you have control or influence over the nodeset creation, I would recommend to change it to not output an empty Value tag (instead it shouldn’t output anything if the value is null). All other nodesets we have tested have done so (https://prosysopc.com/blog/nod…..importing/).
Now technically per the nodeset schema https://github.com/OPCFoundati…..odeSet.xsd I guess it would be allowed XML-wise to have such tag. However, there is a bit of a contradiction since in practice the contents of the Value tag is an encoded Variant value which is to be XML-decoded as the value (and this doesn’t include the Value tag itself) so this would lead to trying to decode an empty string, which is not valid XML (as it doesn’t have a root element).
But I guess we could in the future check for this and treat it the same way as if it wouldn’t exist.
1 Guest(s)

Log In
Register
