Avatar
Please consider registering
guest
sp_LogInOut Log Insp_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 RSSsp_TopicIcon
Codegen NullPointerException when parsing Method arguments (SDK 5.3.0-181, Java 21 & Java 8)
September 10, 2025
9:39, EEST
Avatar
srkum
New Member
Members
Forum Posts: 2
Member Since:
September 9, 2025
sp_UserOfflineSmall Offline

We 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?

September 10, 2025
13:36, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1068
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

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

<Value/>
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.

September 10, 2025
15:06, EEST
Avatar
srkum
New Member
Members
Forum Posts: 2
Member Since:
September 9, 2025
sp_UserOfflineSmall Offline

Hi Bjarne,

Thank you for your response, yes I had one empty value tag in my xml. After I removed that, code generator succeeded.
Smile

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 115
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 100
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 773
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1558
Posts: 6567
Newest Members:
gailschroder72, willardmackellar, vnedrenie_koPi, shaylaholton205, PhilesiaGen, rosaurathiel524, Arthurobext, stefanmacneil3, ralni, illuminationscanada
Moderators: Jouni Aro: 1039, Pyry: 1, Petri: 1, Bjarne Boström: 1054, Jimmy Ni: 26, Matti Siponen: 359, Lusetti: 0
Administrators: admin: 1