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

Catalog resolution failure after upgrade to 2.0.4 #306

Closed
michael-o opened this issue Aug 16, 2023 · 17 comments · Fixed by #329
Closed

Catalog resolution failure after upgrade to 2.0.4 #306

michael-o opened this issue Aug 16, 2023 · 17 comments · Fixed by #329
Assignees
Labels
bug jaxb2 Issue with jaxb 2.x maven-plugin Issue concerns maven plugin
Milestone

Comments

@michael-o
Copy link

michael-o commented Aug 16, 2023

As a followup to #244 I expected catalog resolution to work. It does not work with a multi-level setup compared to 0.14.0:

PS C:\Entwicklung\Projekte\jaxb-maven-plugin-bug - Export> mvn clean package -V
Apache Maven 3.8.8 (4c87b05d9aedce574290d1acc98575ed5eb6cd39)
Maven home: C:\Entwicklung\Programme\apache-maven-3.8.8
Java version: 1.8.0_362, vendor: Azul Systems, Inc., runtime: C:\Program Files\Zulu\zulu-8\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] X2TC Proxy Parent                                                  [pom]
[INFO] X2TC Models Parent                                                 [pom]
[INFO] X2TC Proxy Common Model                                            [jar]
[INFO] X2TC Proxy Helper Web Service Model                                [jar]
[INFO] X2TC Proxy Import Web Service Model                                [jar]
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for X2TC Proxy Parent 0.35.7-SNAPSHOT:
[INFO]
[INFO] X2TC Proxy Parent .................................. SUCCESS [  0.257 s]
[INFO] X2TC Models Parent ................................. SUCCESS [  0.005 s]
[INFO] X2TC Proxy Common Model ............................ SUCCESS [  3.867 s]
[INFO] X2TC Proxy Helper Web Service Model ................ SUCCESS [  0.709 s]
[INFO] X2TC Proxy Import Web Service Model ................ FAILURE [  0.262 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.318 s
[INFO] Finished at: 2023-08-16T09:50:43+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.jaxb:jaxb-maven-plugin:2.0.4:generate (generate-model) on project x2tc-proxy-import-ws-model: Unable to parse input schema(s). Error messages should have been provided. -> [Help 1]
...

This issue appears for every imported element:

[INFO] --- jaxb-maven-plugin:2.0.4:generate (generate-model) @ x2tc-proxy-import-ws-model ---
[INFO] Sources are not up-to-date, XJC will be executed.
[WARNING] ReResolvingEntityResolverWrapper : File file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/import-ws-model/src/main/resources/META-INF/x2tc-proxy-common.xsd does not exists.
[WARNING] ReResolvingEntityResolverWrapper : File file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/import-ws-model/src/main/resources/META-INF/x2tc-proxy-helper.xsd does not exists.
[ERROR] Error while parsing schema(s).Location [ jar:file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/helper-ws-model/target/x2tc-proxy-helper-ws-model-0.35.7-SNAPSHOT.jar!/META-INF/x2tc-proxy-common.xsd{15,29}].
org.xml.sax.SAXParseException: 'owningGroup' is already defined
    at com.sun.xml.xsom.impl.parser.ParserContext$1.reportError (ParserContext.java:150)

Attached is a sample project: jaxb-maven-plugin-bug.zip

@laurentschoelens
Copy link
Collaborator

Thanks for the example project.
We'll check this with @mattrpav to see what's wrong here

@laurentschoelens
Copy link
Collaborator

Could you send us in the meantime the output of failure project with -X -e flags to enable extra output ?

@michael-o
Copy link
Author

Compressed output attached: out.log.gz

@laurentschoelens
Copy link
Collaborator

Error details

Error while parsing schema(s).Location [ jar:file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/helper-ws-model/target/x2tc-proxy-helper-ws-model-0.35.7-SNAPSHOT.jar!/META-INF/x2tc-proxy-common.xsd{15,29}].
org.xml.sax.SAXParseException: 'owningGroup' is already defined
Error while parsing schema(s).Location [ jar:file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/common-model/target/x2tc-proxy-common-model-0.35.7-SNAPSHOT.jar!/META-INF/x2tc-proxy-common.xsd{8,36}].
org.xml.sax.SAXParseException: (related to above error) the first definition appears here

@laurentschoelens
Copy link
Collaborator

Error details

Error while parsing schema(s).Location [ jar:file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/helper-ws-model/target/x2tc-proxy-helper-ws-model-0.35.7-SNAPSHOT.jar!/META-INF/x2tc-proxy-common.xsd{15,29}].
org.xml.sax.SAXParseException: 'owningGroup' is already defined
Error while parsing schema(s).Location [ jar:file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/common-model/target/x2tc-proxy-common-model-0.35.7-SNAPSHOT.jar!/META-INF/x2tc-proxy-common.xsd{8,36}].
org.xml.sax.SAXParseException: (related to above error) the first definition appears here

Don't know how but the error comes from non-existing xsd file in helper-ws-model module from what I've seen.
I'll dig more when possible @michael-o
Hoping to find explanation.

Could you confirm that just changing to 0.14.0 version fixes your build without changing anything else in your configuration ?

@laurentschoelens
Copy link
Collaborator

Also seen error of 2.0.3 version
If failed earlier in build with helper module failing to find common.xsd definition from catalog. So I think the point of initial bug is fixed.

Your configuration is a bit more complex since now it fails on the 3rd round (common -> helper refering common -> service refering both common and helper).

Please be patient, we'll try to fix this as soon as possible, even if we go with jakarta release first, since your configuration should also fail with jaxb3 and jaxb4 in my opinion. When fix found, we'll do the necessary release and will notify you to test again with fixed release

Regards

@michael-o
Copy link
Author

Error details

Error while parsing schema(s).Location [ jar:file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/helper-ws-model/target/x2tc-proxy-helper-ws-model-0.35.7-SNAPSHOT.jar!/META-INF/x2tc-proxy-common.xsd{15,29}].
org.xml.sax.SAXParseException: 'owningGroup' is already defined
Error while parsing schema(s).Location [ jar:file:/C:/Entwicklung/Projekte/jaxb-maven-plugin-bug%20-%20Export/models/common-model/target/x2tc-proxy-common-model-0.35.7-SNAPSHOT.jar!/META-INF/x2tc-proxy-common.xsd{8,36}].
org.xml.sax.SAXParseException: (related to above error) the first definition appears here

Don't know how but the error comes from non-existing xsd file in helper-ws-model module from what I've seen. I'll dig more when possible @michael-o Hoping to find explanation.

Could you confirm that just changing to 0.14.0 version fixes your build without changing anything else in your configuration ?

Reverted the sample back to 0.14.0:

...
[INFO] --- maven-jaxb2-plugin:0.14.0:generate (generate-model) @ x2tc-proxy-import-ws-model ---
[INFO] Sources are not up-to-date, XJC will be executed.
[INFO] Episode file [C:\Entwicklung\Projekte\jaxb-maven-plugin-bug - Export - Kopie\models\import-ws-model\target\generated-sources\xjc\META-INF\sun-jaxb.episode] was augmented with if-exists="true" attributes.
[INFO]
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for X2TC Proxy Parent 0.35.7-SNAPSHOT:
[INFO]
[INFO] X2TC Proxy Parent .................................. SUCCESS [  0.238 s]
[INFO] X2TC Models Parent ................................. SUCCESS [  0.000 s]
[INFO] X2TC Proxy Common Model ............................ SUCCESS [  3.458 s]
[INFO] X2TC Proxy Helper Web Service Model ................ SUCCESS [  0.780 s]
[INFO] X2TC Proxy Import Web Service Model ................ SUCCESS [  0.554 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.215 s
[INFO] Finished at: 2023-08-17T14:18:55+02:00

So, yes, 0.14.0 works flawlessly for me.

@michael-o
Copy link
Author

Also seen error of 2.0.3 version If failed earlier in build with helper module failing to find common.xsd definition from catalog. So I think the point of initial bug is fixed.

Your configuration is a bit more complex since now it fails on the 3rd round (common -> helper refering common -> service refering both common and helper).

Please be patient, we'll try to fix this as soon as possible, even if we go with jakarta release first, since your configuration should also fail with jaxb3 and jaxb4 in my opinion. When fix found, we'll do the necessary release and will notify you to test again with fixed release

Regards

Don't worry, take your time. Something is truly fishy. Note that I cannot move to the jakarta namspace because it would force me to change the entire stack wich I cannot do.

@laurentschoelens
Copy link
Collaborator

Also seen error of 2.0.3 version If failed earlier in build with helper module failing to find common.xsd definition from catalog. So I think the point of initial bug is fixed.

Your configuration is a bit more complex since now it fails on the 3rd round (common -> helper refering common -> service refering both common and helper).

Please be patient, we'll try to fix this as soon as possible, even if we go with jakarta release first, since your configuration should also fail with jaxb3 and jaxb4 in my opinion. When fix found, we'll do the necessary release and will notify you to test again with fixed release

Regards

Don't worry, take your time. Something is truly fishy. Note that I cannot move to the jakarta namspace because it would force me to change the entire stack wich I cannot do.

Same for me but with Apache Tiles on one project.
Almost done building a version migrated to jakarta of that framework

@laurentschoelens laurentschoelens self-assigned this Aug 19, 2023
@laurentschoelens
Copy link
Collaborator

@michael-o : could you share me the complete log output of your project with 0.14.0
I tried to have the same and had on both helper / import modules the following output without any class generated :

[INFO] --- maven-jaxb2-plugin:0.14.0:generate (generate-model) @ import-ws-model ---
[WARNING] The plugin is configured to use catalogs and strict mode at the same time.
Using catalogs to resolve schema URIs in strict mode is known to be problematic and may fail.
Please refer to the following link for more information:
https://github.com/highsource/maven-jaxb2-plugin/wiki/Catalogs-in-Strict-Mode
Consider setting <strict>false</strict> in your plugin configuration.

[WARNING] No schemas to compile. Skipping XJC execution. 

@laurentschoelens
Copy link
Collaborator

@michael-o : could you share me the complete log output of your project with 0.14.0 I tried to have the same and had on both helper / import modules the following output without any class generated :

[INFO] --- maven-jaxb2-plugin:0.14.0:generate (generate-model) @ import-ws-model ---
[WARNING] The plugin is configured to use catalogs and strict mode at the same time.
Using catalogs to resolve schema URIs in strict mode is known to be problematic and may fail.
Please refer to the following link for more information:
https://github.com/highsource/maven-jaxb2-plugin/wiki/Catalogs-in-Strict-Mode
Consider setting <strict>false</strict> in your plugin configuration.

[WARNING] No schemas to compile. Skipping XJC execution. 

Found what was wrong in my config : the models pom still pointed out on jaxb-maven-plugin when tested agains 0.14.0

@laurentschoelens
Copy link
Collaborator

By comparing output of 0.14.0 and 2.0.x version, it seems that catalog file is not taken into account with 2.x config, whereas it's well injected in 0.14.0. Still keep analysis what's going on...

@michael-o
Copy link
Author

By comparing output of 0.14.0 and 2.0.x version, it seems that catalog file is not taken into account with 2.x config, whereas it's well injected in 0.14.0. Still keep analysis what's going on...

It is...if you remove the catalog entries you will see that it will try to load the dependencies relatively to the actual schema file.

@laurentschoelens
Copy link
Collaborator

By comparing output of 0.14.0 and 2.0.x version, it seems that catalog file is not taken into account with 2.x config, whereas it's well injected in 0.14.0. Still keep analysis what's going on...

It is...if you remove the catalog entries you will see that it will try to load the dependencies relatively to the actual schema file.

I tried to include your projects in build reactor and it failed due to and error in my config.
Catalog is well taken, still working on the issue ...

@laurentschoelens
Copy link
Collaborator

@michael-o : found a way to fix your issue. I've also included your test project as test project to avoid regression
Previous fix of #244 was not as comprehensive of the code change that it should have been.
PR to come, if we can, we'll include this as 2.0.5 release cut-off which should come soon

@laurentschoelens
Copy link
Collaborator

@michael-o 2.0.5 is released with the fix 😃

@michael-o
Copy link
Author

@michael-o 2.0.5 is released with the fix 😃

Just verified : manifique

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug jaxb2 Issue with jaxb 2.x maven-plugin Issue concerns maven plugin
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants