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

log4j fails with The invoked member is not supported in a dynamic assembly #45

Closed
AliveDevil opened this issue Feb 14, 2022 · 3 comments

Comments

@AliveDevil
Copy link
Collaborator

There is still so much more to do to support .NET Core, than just getting it build on .NET Core.
The whole dynamic-assembly modules need to be reworked in order to interop correctly with core.

I.e. Log4j crashes completely while setting up the LoggerContext:

Unhandled exception. System.TypeInitializationException: The type initializer for 'ch.cyberduck.core.preferences.DefaultPreferences' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'ch.cyberduck.core.preferences.Preferences' threw an exception.
 ---> System.TypeInitializationException: The type initializer for 'org.apache.logging.log4j.core.config.ConfigurationFactory' threw an exception.
 ---> System.NotSupportedException: The invoked member is not supported in a dynamic assembly.
   at Java_java_lang_Class.forName0(String name, Boolean initialize, ClassLoader loader, Class caller) in ikvm-revived\runtime\IKVM.Runtime\openjdk\java.lang.cs:line 76
   at java.lang.Class.forName0(String name, Boolean initialize, ClassLoader loader, Class caller)
   at java.lang.Class.forName(String className, CallerID )
   at org.apache.logging.log4j.util.LoaderUtil.loadClass(String className)
   at org.apache.logging.log4j.util.LoaderUtil.newInstanceOf(String className)
   at org.apache.logging.log4j.util.LoaderUtil.newCheckedInstanceOf(String className, Class clazz)
   at org.apache.logging.log4j.core.util.Loader.newCheckedInstanceOf(String className, Class clazz)
   at org.apache.logging.log4j.core.lookup.Interpolator..ctor(Map properties)
   at org.apache.logging.log4j.core.lookup.Interpolator..ctor()
   at org.apache.logging.log4j.core.config.ConfigurationFactory..ctor()
   at org.apache.logging.log4j.core.config.ConfigurationFactory.Factory..ctor()
   at org.apache.logging.log4j.core.config.ConfigurationFactory.Factory..ctor(1 x0)
   at org.apache.logging.log4j.core.config.ConfigurationFactory..cctor()
   --- End of inner exception stack trace ---
   at org.apache.logging.log4j.core.config.ConfigurationFactory.getInstance()
   at org.apache.logging.log4j.core.LoggerContext.reconfigure(URI configURI)
   at org.apache.logging.log4j.core.LoggerContext.reconfigure()
   at org.apache.logging.log4j.core.LoggerContext.start()
   at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(String fqcn, ClassLoader loader, Object externalContext, Boolean currentContext)
   at org.apache.logging.log4j.core.impl.Log4jContextFactory.<bridge>getContext(String fqcn, ClassLoader loader, Object externalContext, Boolean currentContext)
   at org.apache.logging.log4j.core.impl.Log4jContextFactory.__<overridestub>org.apache.logging.log4j.spi.LoggerContextFactory::getContext(String , ClassLoader , Object , Boolean )
   at org.apache.logging.log4j.LogManager.getContext(ClassLoader loader, Boolean currentContext)
   at org.apache.logging.log4j.LogManager.getLogger(Class clazz)
   at ch.cyberduck.core.preferences.Preferences..cctor()
   --- End of inner exception stack trace ---
   at ch.cyberduck.core.preferences.Preferences.__<clinit>()
   at ch.cyberduck.core.preferences.DefaultPreferences..cctor()
   --- End of inner exception stack trace ---
   at ch.cyberduck.core.preferences.DefaultPreferences..ctor()
   at Ch.Cyberduck.Core.Preferences.AppConfigPreferences..ctor(Locales locales)
   at Ch.Cyberduck.Cli.WindowsTerminalPreferences..ctor() in cyberduck\cli\src\main\csharp\ch\cyberduck\cli\WindowsTerminalPreferences.cs:line 36
   at Ch.Cyberduck.Cli.WindowsTerminal.Main(String[] args) in cyberduck\cli\src\main\csharp\ch\cyberduck\cli\WindowsTerminal.cs:line 38

Offending java source: https://github.com/apache/logging-log4j2/blob/rel/2.17.1/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java#L117

@NightOwl888
Copy link
Contributor

NightOwl888 commented May 29, 2022

Hi there. Could you please try again with https://www.nuget.org/packages/IKVM/8.2.0-prerelease0392 and report back whether this is still an issue?

@AliveDevil
Copy link
Collaborator Author

Currently blocked by #65.

@AliveDevil
Copy link
Collaborator Author

Using ikvmc on that same project with refs set to .NETCoreApp3.1, and running on net6.0-windows10.0.22000.0 doesn't produce mentioned issue anymore. This response file has been used:

-static
-nostdlib
-classloader:ikvm.runtime.AppDomainAssemblyClassLoader
-r:<IKVM_HOME>/refs/*.dll

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