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

Building under graalvm native-image will report an error java.lang.reflect.UndeclaredThrowableException #24

Open
fendo8888 opened this issue Feb 20, 2022 · 1 comment

Comments

@fendo8888
Copy link

fendo8888 commented Feb 20, 2022

de.schlichtherle.xml.PersistenceServiceException: java.lang.reflect.UndeclaredThrowableException
at de.schlichtherle.xml.PersistenceService.load(PersistenceService.java:397)
at de.schlichtherle.license.PrivacyGuard.key2cert(PrivacyGuard.java:174)
at com.xxx.xxxx.loader.license.core.CustomLicenseManager.install(CustomLicenseManager.java:69)
at de.schlichtherle.license.LicenseManager.install(LicenseManager.java:406)
at de.schlichtherle.license.LicenseManager.install(LicenseManager.java:382)
at com.xxx.xxxx.loader.license.core.LicenseVerify.install(LicenseVerify.java:36)
at com.xxx.xxx.loader.launcher.tool.LicenseTool.install(LicenseTool.java:42)
at com.xxx.xxx.loader.launcher.FaasStartApplication.main(FaasStartApplication.java:44)
Caused by: java.lang.reflect.UndeclaredThrowableException
at de.schlichtherle.xml.PersistenceService$1.exceptionThrown(PersistenceService.java:79)
at com.sun.beans.decoder.DocumentHandler.handleException(DocumentHandler.java:359)
at com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:388)
at com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:372)
at java.security.AccessController.doPrivileged(AccessController.java:105)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at com.sun.beans.decoder.DocumentHandler.parse(DocumentHandler.java:372)
at java.beans.XMLDecoder$1.run(XMLDecoder.java:201)
at java.beans.XMLDecoder$1.run(XMLDecoder.java:199)
at java.security.AccessController.doPrivileged(AccessController.java:105)
at java.beans.XMLDecoder.parsingComplete(XMLDecoder.java:199)
at java.beans.XMLDecoder.close(XMLDecoder.java:174)
at de.schlichtherle.xml.PersistenceService.load(PersistenceService.java:395)
... 7 more
Caused by: java.io.IOException: Stream closed
at java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:170)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:214)
at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.read(XMLEntityManager.java:2902)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:674)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:148)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:806)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
at com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:375)
... 17 more

@paddy-axio
Copy link

Have you found a solution or workaround?

This problem still exists when building native image. My application is based on truelicense-core:1.32, I couldn't find out why the application that works in a jar fails to load the license in a native-image citing above error.
I made sure to include my certificate store in the native-image resources.

Caused by: java.lang.Throwable: java.lang.reflect.UndeclaredThrowableException - null
	at de.schlichtherle.xml.PersistenceService$1.exceptionThrown(PersistenceService.java:81) ~[na:na]
	at java.desktop@21/com.sun.beans.decoder.DocumentHandler.handleException(DocumentHandler.java:362) ~[na:na]
	at java.desktop@21/com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:382) ~[na:na]
	at java.desktop@21/com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:376) ~[na:na]
	at java.base@21/java.security.AccessController.executePrivileged(AccessController.java:129) ~[na:na]
	at java.base@21/java.security.AccessController.doPrivileged(AccessController.java:400) ~[na:na]
	at java.base@21/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) ~[na:na]
	at java.desktop@21/com.sun.beans.decoder.DocumentHandler.parse(DocumentHandler.java:376) ~[na:na]
	at java.desktop@21/java.beans.XMLDecoder$1.run(XMLDecoder.java:203) ~[na:na]
	at java.desktop@21/java.beans.XMLDecoder$1.run(XMLDecoder.java:201) ~[na:na]
	at java.base@21/java.security.AccessController.executePrivileged(AccessController.java:129) ~[na:na]
	at java.base@21/java.security.AccessController.doPrivileged(AccessController.java:400) ~[na:na]
	at java.desktop@21/java.beans.XMLDecoder.parsingComplete(XMLDecoder.java:201) ~[na:na]
	at java.desktop@21/java.beans.XMLDecoder.close(XMLDecoder.java:175) ~[na:na]
	at de.schlichtherle.xml.PersistenceService.load(PersistenceService.java:408) ~[na:na]
	... 90 common frames omitted
Caused by: java.lang.Throwable: java.io.IOException - Stream closed
	at java.base@21/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:188) ~[na:na]
	at java.base@21/java.io.BufferedInputStream.getBufIfOpen(BufferedInputStream.java:198) ~[na:na]
	at java.base@21/java.io.BufferedInputStream.fill(BufferedInputStream.java:259) ~[na:na]
	at java.base@21/java.io.BufferedInputStream.implRead(BufferedInputStream.java:325) ~[na:na]
	at java.base@21/java.io.BufferedInputStream.read(BufferedInputStream.java:312) ~[na:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream.readAndBuffer(XMLEntityManager.java:3027) ~[na:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:706) ~[na:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:150) ~[na:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:861) ~[ads-app:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825) ~[ads-app:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[ads-app:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224) ~[ads-app:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637) ~[na:na]
	at java.xml@21/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326) ~[na:na]
	at java.desktop@21/com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:379) ~[na:na]
	... 102 common frames omitted

Apparently, the root cause is when XMLDecoder reads an object from PersistenceService.class. Is there any other resource that need to be hinted?

Caused by: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 2-byte UTF-8 sequence.
	at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(UTF8Reader.java:702)
	at java.xml/com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(UTF8Reader.java:373)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(XMLEntityScanner.java:1699)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.arrangeCapacity(XMLEntityScanner.java:1565)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipString(XMLEntityScanner.java:1603)
	at java.xml/com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:158)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:861)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:825)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1224)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:637)
	at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:326)
	at java.desktop/com.sun.beans.decoder.DocumentHandler$1.run(DocumentHandler.java:379)
	... 12 more

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