Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XmlDeserializer can't read AASX file #172

Closed
Yauhenikapl opened this issue Sep 15, 2023 · 4 comments
Closed

XmlDeserializer can't read AASX file #172

Yauhenikapl opened this issue Sep 15, 2023 · 4 comments

Comments

@Yauhenikapl
Copy link

I am encountering an issue with XmlDeserializer when attempting to read an AASX file. The XmlDeserializer is failing to parse the AASX file properly, resulting in an error.

AASXDeserializer deserializer = null;
try {
    deserializer = new AASXDeserializer(new FileInputStream(path));
    Environment environment = new XmlDeserializer().read(deserializer.getXMLResourceString());
    System.out.println("TEST: " + environment);
 } catch ( InvalidFormatException | DeserializationException | IOException e ) {
    throw new RuntimeException( e );
 }

Example of aasx file: In this repo

Steps to Reproduce:

  1. Put .aasx file and use code provided above;

Expected Behavior:
Get correct Environment object for the next converting to the different model.

Actual Behavior:
After run code provided above recive error

Environment:
Operating System: [macOS 13.5.1]
Programming Language: [Java 17]
XmlDeserializer Version: 1.0.0-milestone-03.1

Additional Information:
Include any additional information that may be relevant to the issue. This could include the contents of the AASX file (if not sensitive), any relevant code snippets, or any other context that might help diagnose the problem.

Screenshots/Error Messages:

java.lang.RuntimeException: org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException: deserialization failed
	at org.eclipse.esmf.aas.to.AasToAspectCommand.run(AasToAspectCommand.java:54)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at org.eclipse.esmf.LoggingMixin.executionStrategy(LoggingMixin.java:41)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at org.eclipse.esmf.SammCli.main(SammCli.java:108)
Caused by: org.eclipse.digitaltwin.aas4j.v3.dataformat.DeserializationException: deserialization failed
	at org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.XmlDeserializer.read(XmlDeserializer.java:101)
	at org.eclipse.esmf.aas.to.AasToAspectCommand.run(AasToAspectCommand.java:51)
	... 10 more
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.asText()" because "valueNode" is null (through reference chain: org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultEnvironment["submodels"]->java.util.ArrayList[0]->org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultSubmodel["semanticId"]->org.eclipse.digitaltwin.aas4j.v3.model.impl.DefaultReference["keys"])
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:402)
	at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:361)
	at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.wrapAndThrow(BeanDeserializerBase.java:1826)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:316)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:359)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
	at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:177)
	at com.fasterxml.jackson.dataformat.xml.deser.XmlDeserializationContext.readRootValue(XmlDeserializationContext.java:91)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4730)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3677)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3645)
	at org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.XmlDeserializer.read(XmlDeserializer.java:99)
	... 11 more
Caused by: java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.asText()" because "valueNode" is null
	at org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.KeyDeserializer.readValue(KeyDeserializer.java:35)
	at org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.KeyDeserializer.readValue(KeyDeserializer.java:27)
	at org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.NoEntryWrapperListDeserializer.createEntriesFromObjectNode(NoEntryWrapperListDeserializer.java:66)
	at org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.NoEntryWrapperListDeserializer.deserialize(NoEntryWrapperListDeserializer.java:50)
	at org.eclipse.digitaltwin.aas4j.v3.dataformat.xml.deserialization.NoEntryWrapperListDeserializer.deserialize(NoEntryWrapperListDeserializer.java:36)
	at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
	at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:314)
	... 26 more

Note:
You know, perhaps I am using something wrong and you can support to understand how I can fix it, because each file which I try to deserialize does't work like we expected.

Thanks,
Best Regards!

@FrankSchnicke
Copy link
Contributor

Hi,

this issue is related to AASX file itself. It includes empty entries, e.g. keys, conceptDescriptionaris and assets:

image

According to the official specification this is not valid. I'm already in exchange with the people at IDTA in regard to this - however, please raise a GitHub issue at the linked repository to create additional visibility.

Best regards,
Frank

@Yauhenikapl
Copy link
Author

@FrankSchnicke Thank you a lot for support in this issue.

I'm going to create an issue at the linked repository.

Thanks,
Best Regards!

@Yauhenikapl
Copy link
Author

@FrankSchnicke,

Issue was created to the submodels-templates repo.

Thanks,
Best Regards!

@FrankSchnicke
Copy link
Contributor

I revisited this issue by coincidence and realized that the templates are still V2 - so you can't open them anyways with AAS4J.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants