moqui / moqui-framework

Use Moqui Framework to build enterprise applications based on Java. It includes tools for databases (relational, graph, document), local and web services, web and other UI with screens and forms, security, file/resource access, scripts, templates, l10n, caching, logging, search, rules, workflow, multi-instance, and integration.
http://www.moqui.org
Other
279 stars 200 forks source link

use jdk16 ,the Error occurred when load. #571

Closed fenyun689 closed 1 year ago

fenyun689 commented 1 year ago

openjdk version "16.0.1" 2021-04-20 OpenJDK Runtime Environment (build 16.0.1+9-24) OpenJDK 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)

java -jar .\MoquiDemo-3.0.0.war load

Using temporary directory: D:\obsidian\moqui\execwartmp Determined runtime by defaulting to current directory: . Canonicalized runtimePath: D:\obsidian\moqui Determined conf by default (dev conf file): null Loading data with args {load=} Unexpected problem occured during version sanity check Reported exception: java.lang.AbstractMethodError: Receiver class org.apache.logging.slf4j.SLF4JServiceProvider does not define or inherit an implementation of the resolved method 'abstract java.lang.String getRequestedApiVersion()' of interface org.slf4j.spi.SLF4JServiceProvider. at org.slf4j.LoggerFactory.versionSanityCheck(LoggerFactory.java:297) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:141) at org.slf4j.LoggerFactory.getProvider(LoggerFactory.java:421) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:407) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:356) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:382) at org.moqui.Moqui.(Moqui.java:37) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at MoquiStart.main(MoquiStart.java:146) Error loading or running Moqui.loadData with args [{load=}]: java.lang.NoSuchMethodError: 'boolean org.apache.logging.log4j.spi.LoggerContextFactory.isClassLoaderDependent()' java.lang.NoSuchMethodError: 'boolean org.apache.logging.log4j.spi.LoggerContextFactory.isClassLoaderDependent()' at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:56) at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:46) at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:33) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:382) at org.moqui.Moqui.(Moqui.java:37) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at MoquiStart.main(MoquiStart.java:146)

jonesde commented 1 year ago

It's likely a classloader issue. I have done one brief test with Java 17 (the next long-term release after Java 11) and saw that some module management had become mandatory or something. I haven't looked into it further so I can't say how much effort will be required to support Java 17, and hopefully still be backward compatible with Java 11.

One big question is whether we'll still be able play classloader games to get jar and class/resource files from component lib and classes directories at runtime, if not there are alternative ways to run Moqui, but it is limiting). There will also be other new constraints like no more finalize() methods and I'm not yet sure of a way to make sure resources are cleaned up and warn if not when objects are GC'ed... and that is a nice debugging feature to have that we'll lose.

Those are some issues I'm aware of, and there are likely many I'm not yet aware of. Either way, Moqui won't be supporting Java 16. Java 17 is the next version Moqui will support (the next LTS version), and usually when updating to that if we can stay backward compatible with the previous LTS then it will be backward compatible with all in between. For a while Moqui supported Java 8 and Java 11, but with some quirks under Java 11 that could not be addressed until Java 11 was required (because of non backward compatible changes in Java).

fenyun689 commented 1 year ago

hello jonesde, I still have the this error when using java11, The prompt is that slf4j-api.jar and log4j2.jar are incompatible