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
java.lang.IllegalStateException: Could not parse the Opc.Ua.NodeSet2.xml nodeset
November 18, 2024
19:19, EET
Avatar
in-fke
Member
Members
Forum Posts: 36
Member Since:
June 8, 2016
sp_UserOfflineSmall Offline

After upgrading from 4 to 5 – I get this message:
java.lang.IllegalStateException: Could not parse the Opc.Ua.NodeSet2.xml nodeset

Unfortunately, the IllegalStateException does not nest any root cause!?

Stack:
Thread [main] (Suspended (exception IllegalStateException))
owns: UaServer (id=89)
NodeManagerRoot$a.() line: 119 [local variables unavailable]
NodeManagerRoot.cko() line: 493
NodeManagerRoot.init() line: 720
NodeManagerTable.init() line: 2619
NodeManagementServiceHandler.init() line: 848
UaServer.initServiceHandlers() line: 3059
UaServer.init() line: 1378

Log before it get’s there.

2024-11-18T18:01:27,611 INFO [main] server.NodeManagerRoot:90 Loading information model jar:file:/C:/dev/M3_REPO/com/prosysopc/ua/prosys-opc-ua-client-server/5.2.6-151/prosys-opc-ua-client-server-5.2.6-151.jar!/com/prosysopc/ua/types/opcua/server/Opc.Ua.NodeSet2.xml
2024-11-18T18:01:27,660 WARN [main] utils.XMLFactoryCache:95 Cannot initialize XML factories to ignore DTD processing (CVE-2018-12585), please update java to newer version or configure manually if custom XML parser framework is in use

What could be the cause of this? Mayb we have different classpaths?
If it’s another exception, it may be better to nest it into the IllegalStateException

Using Java17.
Somewhat related: https://forum.prosysopc.com/forum/opc-ua-java-sdk/opc-ua-server-startup-slow-due-to-domparser-doing-jar-scan/#p5400

PS where is documentation on the markup that can be used in this forum? I could not find any documentation. Thanks!

November 19, 2024
10:24, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Sorry for the trouble, there might be something we didn’t account for. While it probably doesn’t fix it, can you please try with 5.2.8, that includes the ’cause’ in that “Could not parse the Opc.Ua.NodeSet2.xml nodeset” IllegalStateException, which probably helps in figuring out what has happened.

November 19, 2024
19:28, EET
Avatar
in-fke
Member
Members
Forum Posts: 36
Member Since:
June 8, 2016
sp_UserOfflineSmall Offline

New Stack with 5.2.8
Dont know how to do markup that does not break sharp brackets, but
“String.hashCode()” because “” is null
is supposed to say (I am writing it with entity encoding):
“String.hashCode()” because “<local8>” is null

Caused by: java.lang.ExceptionInInitializerError
at com.prosysopc.ua.server.NodeManagerRoot.cko(SourceFile:493)
at com.prosysopc.ua.server.NodeManagerRoot.init(SourceFile:720)
at com.prosysopc.ua.server.NodeManagerTable.init(SourceFile:2619)
at com.prosysopc.ua.server.NodeManagementServiceHandler.init(SourceFile:848)
at com.prosysopc.ua.server.UaServer.initServiceHandlers(SourceFile:3059)
at com.prosysopc.ua.server.UaServer.init(SourceFile:1378)
… 32 more
Caused by: java.lang.IllegalStateException: Could not parse the Opc.Ua.NodeSet2.xml nodeset
at com.prosysopc.ua.server.NodeManagerRoot$a.(SourceFile:119)
… 39 more
Caused by: java.lang.NullPointerException: Cannot invoke “String.hashCode()” because “” is null
at com.prosysopc.ua.d.parse(SourceFile:511)
at com.prosysopc.ua.UaNodeSet.parseXml(SourceFile:1102)
at com.prosysopc.ua.UaNodeSet.parseXml(SourceFile:1046)
at com.prosysopc.ua.server.NodeManagerRoot$a.(SourceFile:96)
… 39 more

November 20, 2024
10:31, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Does that WARN about “Cannot initialize XML factories to ignore DTD processing ” still happen? My guess would be it does..

Can you do the following by using the same Java version (and environment), in just a main method (or where you would first use the SDK normally):
javax.xml.parsers.DocumentBuilderFactory.newInstance()
and then for the instance
javax.xml.parsers.DocumentBuilderFactory.setNamespaceAware(true) <– this probably throws in your case?
javax.xml.parsers.DocumentBuilderFactory.newDocumentBuilder()

Basically the WARN should be related to the steps https://cheatsheetseries.owasp.org/cheatsheets/XML_External_Entity_Prevention_Cheat_Sheet.html#Java failing. We do that to prevent some XML-related attacks, but the WARN should only happen with Java 6 (so basically shouldn’t with SDK 5.x since 8 is minimum, but the init code is same as in 4.x). However, for com.prosysopc.ua.UaNodeSet functionality we had to add DocumentBuilderFactory.setNamespaceAware(true) as part of the com.prosysopc.ua.stack.utils.XMLFactoryCache initializations. So if that somehow fails by itself the WARN would appear (and is confusing, we need to change that).

IF I remove that setNamespaceAware(true) and start SampleConsoleServer, I get a NPE regrading a switch-case on a String, which matches your stacktrace.

Since we didn’t get this error in any of our testing and we did test on all major platforms, do you run in some sort of a special setup? (continue in uajava-support@prosysopc.com if not possible to answer here)

I could theorize e.g. GraalVM or maybe OSGi etc. something that has possibly removed the NamespaceAware implementation from the runtime itself or hides it somehow so that it cannot be found. Or maybe if some libs are used that override the xml parsers inside the typical runtime and they wouldn’t have a NamespaceAware implementation. IF yes, maybe you have some configuration option to make it visible/find-able?

P.S.
Sorry, the formatting options are not that great. HTML pre and code tags can be used, but I heavily recommend writing the answer in a notepad first, since both have issues and can remove e.g. xml elements (and indentation doesn’t work).

November 25, 2024
17:03, EET
Avatar
in-fke
Member
Members
Forum Posts: 36
Member Since:
June 8, 2016
sp_UserOfflineSmall Offline

We are assuming, it’s our Xerces Jar in the Classpath, which collides with JRE’s implementation. We will check that.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
34 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: 726

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_gallery

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

Administrators: admin: 1