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

dbptk-app-2.10.1.jar: javax.xml.bind.JAXBException with Java 15 #531

Closed
ibbenz opened this issue Sep 23, 2022 · 5 comments
Closed

dbptk-app-2.10.1.jar: javax.xml.bind.JAXBException with Java 15 #531

ibbenz opened this issue Sep 23, 2022 · 5 comments
Assignees

Comments

@ibbenz
Copy link

ibbenz commented Sep 23, 2022

After starting up the dbptk-app the following errors occurred:

Errors:
WARN could not get type for name javax.xml.bind.annotation.adapters.XmlAdapter from any class loader
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException

This issue seems to origin from an incompatibility with Java 15.
I use OpenJDK Runtime Environment (build 15.0.2+10) from BellSoft.

According to the following link the jaxb-api jar has to be integrated in the application:
https://www.studytonight.com/post/solved-javalangnoclassdeffounderror-javaxxmlbindjaxbexception-in-java-11

Question
Will there be soon a release which will tackle this issue?
Which would be a feasible workaround where the dbptk-app
is able to run with Java 15?

@luis100
Copy link
Member

luis100 commented Sep 23, 2022

You can add the additional jaxb-api jar into the classpath as you would do to add additional JBDC drivers.
https://github.com/keeps/dbptk-developer/wiki/How-to-use-a-JDBC-driver-in-DBPTK-Developer

@ibbenz
Copy link
Author

ibbenz commented Sep 26, 2022

Thank you, the validation seems to work:

java -cp "C:\KOST\Software_KOST\dbptk_Developer\dbptk-app-2.10.1.jar;C:\KOST\Software_KOST\dbptk_Developer\jaxb-api-2.3.1.jar" com.databasepreservation.Main validate -if C:\KOST\SIARD_TESTS\2022_07_11_SIARD_Test_MySQL\0_Testdatei\0_4-6_oe_Northwind_complex.siard

@stighemmer
Copy link

stighemmer commented Jan 4, 2023

This error is still present for dbptk-2.10.3.jar
luis's fix does not fix.

C:\Users\SH1U\Downloads>java "-Dfile.encoding=UTF-8" -cp "c:\users\sh1u\downloads\dbptk-app-2.10.3.jar;c:\users\sh1u\downloads\jaxb-api-2.4.0-b180830.0359.jar" com.databasepreservation.Main validate -import-file TestDB-with-slash.siard
Validate SIARD at 'TestDB-with-slash.siard'
Exception in thread "main" java.lang.IllegalAccessError: class com.databasepreservation.modules.siard.validate.component.tableData.RequirementsForTableDataValidator (in unnamed module @0x3b9d6699) cannot access class com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl (in module java.xml) because module java.xml does not export com.sun.org.apache.xerces.internal.jaxp to unnamed module @0x3b9d6699
at com.databasepreservation.modules.siard.validate.component.tableData.RequirementsForTableDataValidator.(RequirementsForTableDataValidator.java:145)
at com.databasepreservation.modules.siard.validate.component.factories.RequirementsForTableDataComponentFactory.buildComponent(RequirementsForTableDataComponentFactory.java:55)
at com.databasepreservation.modules.siard.validate.SIARDValidateModule.getValidationComponents(SIARDValidateModule.java:205)
at com.databasepreservation.modules.siard.validate.SIARDValidateModule.validate(SIARDValidateModule.java:118)
at com.databasepreservation.SIARDValidation.validate(SIARDValidation.java:92)
at com.databasepreservation.Main.runValidation(Main.java:191)
at com.databasepreservation.Main.internalMain(Main.java:129)
at com.databasepreservation.Main.main(Main.java:81)

C:\Users\SH1U\Downloads>java -version
openjdk version "17.0.5" 2022-10-18 LTS
OpenJDK Runtime Environment Corretto-17.0.5.8.1 (build 17.0.5+8-LTS)
OpenJDK 64-Bit Server VM Corretto-17.0.5.8.1 (build 17.0.5+8-LTS, mixed mode, sharing)

@luis100 luis100 self-assigned this Jan 4, 2023
@luis100
Copy link
Member

luis100 commented Jan 4, 2023

Try this one:

wget https://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.3.1/jaxb-api-2.3.1.jar
java  --add-opens java.xml/com.sun.org.apache.xerces.internal.jaxp=ALL-UNNAMED -cp dbptk-app-2.10.3.jar:jaxb-api-2.3.1.jar com.databasepreservation.Main validate -if test.siard

We will try to improve Java 9+ compatibility in the next release.

@stighemmer
Copy link

That worked! Thank you. On Windows the command line ended up as:
java "-Dfile.encoding=UTF-8" --add-opens java.xml/com.sun.org.apache.xerces.internal.jaxp=ALL-UNNAMED -cp "dbptk-app-2.10.3.jar;jaxb-api-2.3.1.jar" com.databasepreservation.Main validate -if TestDB-with-slash.siard

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

No branches or pull requests

4 participants