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

Fix log4j version #230

Merged
merged 1 commit into from
May 10, 2024
Merged

Fix log4j version #230

merged 1 commit into from
May 10, 2024

Conversation

haydar-metin
Copy link
Contributor

@haydar-metin haydar-metin commented May 2, 2024

What it does

The error was caused by maven that used log4j with the version 3.0.0-beta.
The targetplatform uses 2.19.0 - now we are limiting the version of log4j to be in range of 2.19.0 <= x <= 2.23.1 for maven. We probably also should limit the rest of the dependencies.

Moreover, I was not able to use the build the project with Eclipse IDE and had to change the location of jetty within the targetplatform. Fixed by installing PDE M2 Integration

Closes eclipse-glsp/glsp#1312

How to test

Run the following command in the root folder:

mvn clean verify -Pm2 -Pfatjar && java -jar ./examples/org.eclipse.glsp.example.workflow/target/org.eclipse.glsp.example.workflow-2.1.0-glsp.jar -p 8081 -w

The following error should not be thrown anymore:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at org.eclipse.glsp.example.workflow.launch.WorkflowServerLauncher.main(WorkflowServerLauncher.java:35)
Caused by: org.apache.logging.log4j.plugins.di.NotInjectableException: No @Inject constructor or default constructor found for chain Key[type: org.apache.logging.log4j.core.lookup.InterpolatorFactory] -> Key[type: java.util.Map<java.lang.String, java.util.function.Supplier<org.apache.logging.log4j.core.lookup.StrLookup>>; namespace: Lookup]
	at org.apache.logging.log4j.plugins.di.DefaultInstanceFactory.createDefaultFactory(DefaultInstanceFactory.java:133)
	at org.apache.logging.log4j.plugins.di.DefaultInstanceFactory.lambda$getFactory$3(DefaultInstanceFactory.java:111)
	at java.base/java.util.Optional.orElseGet(Optional.java:364)
	at org.apache.logging.log4j.plugins.di.DefaultInstanceFactory.getFactory(DefaultInstanceFactory.java:111)
	at org.apache.logging.log4j.plugins.di.InstanceFactory.getInstance(InstanceFactory.java:126)
	at org.apache.logging.log4j.plugins.di.DefaultInstanceFactory.lambda$getArgumentFactory$9(DefaultInstanceFactory.java:211)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
	at org.apache.logging.log4j.plugins.di.DefaultInstanceFactory.lambda$registerBundleMethod$13(DefaultInstanceFactory.java:293)
	at org.apache.logging.log4j.plugins.di.InstanceFactory.getInstance(InstanceFactory.java:115)
	at org.apache.logging.log4j.core.config.AbstractConfiguration.<init>(AbstractConfiguration.java:185)
	at org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:41)
	at org.apache.logging.log4j.core.LoggerContext.<init>(LoggerContext.java:89)
	at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.createContext(ClassLoaderContextSelector.java:289)
	at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:240)
	at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:148)
	at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:131)
	at org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:125)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:156)
	at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:49)
	at org.apache.logging.log4j.LogManager.getContext(LogManager.java:127)
	at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:554)
	at org.eclipse.glsp.server.launch.CLIParser.<clinit>(CLIParser.java:29)
	... 1 more

Follow-ups

Changelog

  • This PR should be mentioned in the changelog
  • This PR introduces a breaking change (if yes, provide more details below for the changelog and the migration guide)

@tortmayr tortmayr self-requested a review May 2, 2024 12:48
Copy link
Contributor

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moreover, I was not able to use the build the project with Eclipse IDE and had to change the location of jetty within the targetplatform.

Seems like you are missing the PDE M2 Integration plugin. This is required to resolve mvn dependencies in your target platform.
This should be available in the default release update site:
image

However, if the oomp release site is stable and contains everything we need, I'm also happy to switch to that one.

It seems like you have directly updated the r2023-09.target. We use the .tpd (Target Platform DSL) files in this project, because they are easier to maintain an handle. You need to install the plugin from https://download.eclipse.org/cbi/updates/tpd/nightly/N202403260932/index.html

Instead of modyifing the target directly please update the corresponding .tpd file and then create the target platform via context menu or shortcut (ctrl+r):

image

Please also adapt the other .tpd fles (r2022-12.tpd, r2021-09.tpd).

@haydar-metin
Copy link
Contributor Author

@tortmayr Thank you for providing those helpful details. Now, only the maven file has been updated.

Copy link
Contributor

@tortmayr tortmayr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. LGTM!

@tortmayr tortmayr merged commit fc5d3b8 into eclipse-glsp:master May 10, 2024
6 checks passed
@haydar-metin haydar-metin deleted the issues/1312 branch May 10, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Follow instructions to get server JAR file and run it causes Java exception
2 participants