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
Issue with missing IdsCodegenUtils class in generated class
August 24, 2022
11:10, EEST
Avatar
vittorio.parrella
Naples, IT
Member
Members
Forum Posts: 7
Member Since:
August 24, 2022
sp_UserOfflineSmall Offline

Hello,
we are currently evaluating the Java SDK with java 17 jdk and ran into a problem with generating our custom model with the codegen tool in the SDK.

In short, in the class DataTypeIdsInit one of the classes generated under com.prosysopc.ua.types.opcua, is missing a reference to the IdsCodegenUtils class.
This does not allow to compile our test application and so we cannot continue.
Has anyone faced this issue before?

Thank you for the support,
Vittorio.

August 24, 2022
15:09, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 982
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Hmm odd.. however just to doublecheck, since you say “com.prosysopc.ua.types.opcua”, are you trying to generate the base namespace “http://opcfoundation.org/UA/”? That is already generated by us to the mentioned package and compiled as part of the SDK, as the SDK itself uses also those classes. This also means that this very package name cannot very easily be used for any other model. Also the base information model is not yet “user-update-able” either. I can give a more detailed answer if needed.

It is also possible that the above had nothing to do with this. But basically the “IdsCodegenUtils” is a hardcoded-package-private internal helper related to the base information model that optimizes classloading times as we know all NodeIds are numeric ids. Basically the only way (other than bugs etc.) it would appear in the output of Codegen is for the base info model.

P.S.
(yes, the tool probably could be improved to not allow attempting generating the base namespace “again”, but we also use that internally for the SDK as-is currently)

August 24, 2022
15:34, EEST
Avatar
vittorio.parrella
Naples, IT
Member
Members
Forum Posts: 7
Member Since:
August 24, 2022
sp_UserOfflineSmall Offline

Hi, thank you for the reponse.

You are right saying that i was generating the “http://opcfoundation.org/UA/” model, but that is because without it the codegen tool
fails to generate anything and stops with the error: “com.prosysopc.ua.codegen2.e: No model for namespace: http://opcfoundation.org/UA/, required by:
at com.prosysopc.ua.codegen2.a.c.a(SourceFile:1304)
at com.prosysopc.ua.codegen2.d.a(SourceFile:75)
at com.prosysopc.ua.codegen2.Main.main(SourceFile:114)”

In our model however i’ve found this snippet: https://pastebin.com/Kwhbib8W (I’ve had to use pastebin because it kept being stripped)

Do you think it makes sense or is it required?
Thank you for the support.

August 24, 2022
16:30, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 982
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

The models can depend on other models. Every model implicitly requires the base model “http://opcfoundation.org/UA/” (but that is nowadays also mentioned in the ‘Models’ xml block). However, I must note that we do not yet support OPC UA version 1.05.x, only 1.04.x. NOTE!, the model might not truly need 1.05 (e.g. every model made with the newest UaModeler will have it like that), but it might not be very easy for you to see if that is a true dependency on 1.05 or not. For now, assuming it is not (if compilation fails after generation it might need it e.g. if some 1.05 type is needed).

In the codegen configurations the models folder is given as the modelSources/modelSource entry (you can have multiple, every xml files in those folders is interpreted as a model file). The “No model for namespace: http://opcfoundation.org/UA/,” error meant there was not a model that would provide that namespace. All configured models are loaded. When generating the tool will pick up the required model with the namespace and the model’s their dependencies (recursively).

If you look at the SDK distribution zip (unzipped), the codegen/commandline/models/ (or codegen/maven-integeration/maven-integration-sample/models/) do contain the base information model ‘Opc.Ua.NodeSet2.xml’. So basically you must have both your model and the base model in the folder. Then you should (hopefully) be just able to generate your namespace. Alternatively if you just put your model to that folder and edit the sample configurations it should generate (with the assumption that there is no 1.05 “thing” that breaks it)

P.S.
Mentioning just in case, basically while it might look that you could use a different version of the base model as it is just a file, it will not work in practice due to multiple reasons, but skipping that for now as it is kinda a long post. Also we are generally aware that at some point we need to support 1.05 information models, but IF this model truly needs it it would be the first one we know of.

August 24, 2022
16:34, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 982
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

P.S.2 and just to be sure, do NOT try to generate “http://opcfoundation.org/UA/”, if you have a single model, the configuration for the generates block should look like
(And yes, seems it is very hard to explain it here as the tags contain “code” as tags in the configuration…. anyway, please look at e.g. the sampletypesconf.xml within the unzipped_sdk_distribution_root/codegen/commandline/configexamples or try to generate that first and then adapt the configuration to your model)

August 24, 2022
16:42, EEST
Avatar
vittorio.parrella
Naples, IT
Member
Members
Forum Posts: 7
Member Since:
August 24, 2022
sp_UserOfflineSmall Offline

Thank you, i’ve removed from the configuration the dependency and it has gone further now.

The error i get is about “com.prosysopc.ua.codegen2.e: Cannot parse QualifiedName 65535:Description, no namespace uri for index Optional.absent()”, if however I change
the definition in the nodeset to “1:Description” from “65535:Description” it generates the classes correctly.

Do you think this might be a compilation error of the nodeset or maybe an incompatibility with a new feature of 1.05 spec?

Thank you.

August 24, 2022
16:56, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 982
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

I would really need to see the model to say. IF possible, can you send it to uajava-support@prosysopc.com?

Basically the model must also be valid for it to generate/work. IF https://www.unified-automation.com/products/development-tools/uamodeler.html has been used to make it, it typically is, if not then anything could be wrong.

If you cannot send the model I can note however that error would happen if you used a QualifiedName with invalid namespace index. That is also a long topic, but basically each model has a lookup logic that the NamespaceUris/Uri at the start define the indexes, first entry is 1 as 0 is always reserved for the base namespace (also if it is 0 it is typically not written as it is implicit). Thus for a 65535:Description QualifiedName to be valid, you would need to have the NamespaceUris block have 65535 Uri elements and the namespaceuri matching the index 65535 would be the 65535th Uri.

P.S. the indexes in the model are NOT the same as on the server, each use the same “compression logic” of using indexes as shortforms of uris, but the mapping table is different (i.e. each model has their own table and the the UaServer has it’s own and basically when the models are loaded model index -> model uri -> server namespaceuri -> server index translation happens).

P.S.2
Codegen specifically needs the NamespaceUris, because basically anything it outputs uses the uris as we cannot know at generation time what the indexes are on the server (and if the same classes would be used of different servers the index can be different, in theory the mapping table of the server is only valid in the context of a single session and could change after server restart etc. though this rarely happens in practice or almost never).

August 24, 2022
17:51, EEST
Avatar
vittorio.parrella
Naples, IT
Member
Members
Forum Posts: 7
Member Since:
August 24, 2022
sp_UserOfflineSmall Offline

I’m sorry but i don’t think i’m allowed to send the model as its from a customer.

In any case we’ll notify the customer that the model generated seems to have problems because I’ve just tried to regenerate it with UaModeler from the supposed source and cannot do it.

Thank you for the time being i’ll post a new topic if we have other questions.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
20 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 75

ibrahim: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 707

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1466

Posts: 6253

Newest Members:

christi10l, ahamad1, Flores Frederick, ellenmoss, harriettscherer, shanonhumphreys, KupimotoblokfuB, tamhollander5, paulinafcf, bridgette18l

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 982, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 319, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1