mguessan / davmail

DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway - Synced with main subversion repository at
http://davmail.sourceforge.net
GNU General Public License v2.0
582 stars 86 forks source link

O365Interactive fails with "superclass access check failed: class davmail.exchange.auth.O365InteractiveAuthenticatorFrame" #344

Closed niol closed 7 months ago

niol commented 8 months ago

from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1067650

When trying "O365Interactive" mode, the login window is never shown and I get the following stacktrace:

Exception in thread "AWT-EventQueue-0" java.lang.IllegalAccessError: superclass access check failed: class davmail.exchange.auth.O365InteractiveAuthenticatorFrame$2 (in unnamed module @0x112d0a71) cannot access class sun.net.www.protocol.https.Handler (in module java.base) because module java.base does not export sun.net.www.protocol.https to unnamed module @0x112d0a71
    at java.base/java.lang.ClassLoader.defineClass1(Native Method)
    at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
    at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
    at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862)
    at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681)
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
    at davmail.exchange.auth.O365InteractiveAuthenticator.lambda$authenticate$0(O365InteractiveAuthenticator.java:150)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

It seems sun.net.www.protocol.https.Handler is private API and cannot be used.

mguessan commented 8 months ago

To run O356Interactive you need OpenJFX and a custom https connection wrapper.

This connection wrapper does not work with recent java versions unless you set the options:

--add-exports java.base/sun.net.www.protocol.https=ALL-UNNAMED

In your case the options are missing and class loading fails.

On debian I didn't see any recent OpenJFX version (latest is for Java 11).

A workaround is to use platform independent package and download latest Azul JDK with:

./davmail azul
niol commented 7 months ago

OK this fixes the problem. Is this to be considered as a workaround and there is some more work need to avoid using java private APIs? If not, this can be closed as the problem is solved from a user point of view. Thanks!

esabol commented 7 months ago

You can close the issue. It's not a workaround. It's just how things work.