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

Unable to run the sample project with the given steps #13

Open
ravindrasubedi opened this issue Mar 9, 2022 · 10 comments
Open

Unable to run the sample project with the given steps #13

ravindrasubedi opened this issue Mar 9, 2022 · 10 comments

Comments

@ravindrasubedi
Copy link

ravindrasubedi commented Mar 9, 2022

I have followed the steps to run the given example.
However I am getting below error :

15:03:03.939 [main] WARN org.reflections.Reflections - given scan urls are empty. set urls in the configuration
Exception in thread "main" java.lang.IllegalArgumentException: The Context Map must at least contain one Bounded Context to be serialized!
at org.contextmapper.discovery.ContextMapSerializer.serializeContextMap(ContextMapSerializer.java:42)
at com.tcs.isn.LakesideMutualContextMapDiscoverer.main(LakesideMutualContextMapDiscoverer.java:48)

@stefan-ka
Copy link
Member

Hi @ravindrasubedi

Have you removed the spring-boot-maven-plugin plugin from the POM's before you installed the backends to your local maven repository as described in the note in step 2?

I know this is an ugly workaround. But the reflections library does not find the classes for Spring Boot JARs automatically because of the BOOT-INF folder.

Also maybe try it with the new release 1.4.0 (I updated the reflections library). However, the workaround above is still needed.

Best regards,
Stefan

@ravindrasubedi
Copy link
Author

Hi @stefan-ka

Yes, I had already tried removing 'spring-boot-maven-plugin' from the pom.xml files.
No luck even after upgrading to 1.4.0.

Regards,
Ravindra

@stefan-ka
Copy link
Member

Interesting. I reproduced the steps and it works for me. Which Java version are you using @ravindrasubedi?

@ravindrasubedi
Copy link
Author

@stefan-ka I am using JDK 1.8

@stefan-ka
Copy link
Member

@ravindrasubedi
Okay, I'm on Java 11 now. Does it have to be Java 8? :)

@j-ruch
Copy link

j-ruch commented Aug 27, 2024

Dear @stefan-ka

I would like to follow up on this open issue. I'm currently working on LakesideMutual and wanted to try out the discovery function of your Context Mapper. I followed the detailed steps in your README but the discovery function is failing, but with a different error message than @ravindrasubedi experienced.

My system:

  • MS Surface, Windows 11
  • Intellij IDEA
  • Oracle OpenJDK 21.0.2 and graalvm-jdk-21.0.2+13.1
  • Maven 3.9.4
  • Gradle 8.10

My Procedure:
I cloned the LakesideMutual project and this context-mapper-discovery project.
I tried to build it with gradle but it did not build correctly on my machine, I received the following issue:

image

Now I'm by no means an expert in gradle, I tried to resolve the following issue by adding an additional repository to your gradle build file according to the official gradle central websites:
https://docs.gradle.org/current/userguide/declaring_repositories.html
https://plugins.gradle.org/plugin/org.ajoberstar.grgit/3.1.1

The resulting code snippet from the gradle file is:

repositories { maven { url = uri("https://plugins.gradle.org/m2/") } }

Now the issue kept coming up, that is why I turned to an extra maven project.
I attach you both files such that you can see what I have configured. You will have to rename them to .java and .xml on your machine.

The resulting Java class:
ExampleContextMapDiscoverer.txt

The resulting pom file:
pom.txt

I removed the Spring Boot Maven Plugin from each backend project and build them all with mvn clean install and then executed the ExampleContextMapDiscoverer main class above.
The stacktrace which I receive when running this setup is in this file:
stacktrace.txt

The stacktrace mentions that multiple slf4j bindings were found, I have removed to URLs because they contain paths from my personal machine. The question arises, might these bindings be the problem?
The actual error seems to come from a google library. Is it possible that this library was added later on in the project and might mess with the reflections mechanism?

In case you need further details feel free to contact me.
Thanks a lot and kind regards
Jan

@stefan-ka
Copy link
Member

Hi @j-ruch

Should be fixed now ;) Could you check whether it works for you as well? The problem were just some outdated dependencies in the Gradle build; we haven't touched the project for a while.

Best regards,
Stefan

@j-ruch
Copy link

j-ruch commented Aug 29, 2024

Hi @stefan-ka thanks a lot for the quick support!
I still have some problems, but maybe these occur due to my setup or missing knowhow with gradle...

I performed the following actions:

  1. Pull the latest changes
  2. Build the main context-map-discovery project with OpenJDK 20 and Gradle 8.10 --> Success
  3. Build the inner LakesideMutual Example project with OpenJDK 11 and Gradle 5.2.1 --> Failure

The file 'gradle-wrapper.properties' in the inner LakesideMutual Example project contains the following line:

distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip

IntelliJ automatically installed the correct, pre-defined JDK via built-in Amazon Corretto JDK. The build worked out fine. But I received the following error while executing the main class 'LakesideMutualContextMapDiscoverer'

image

I assumed that there might be a problem with the built-in JDK 11 and switched to OpenJDK 20 back again. I had to update Gradle to 8.10. I saw that you changed the ''gradle-wrapper.properties in the outer project. Thus I changed it to the latest gradle release in the inner 'gradle-wrapper.properties':

distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-all.zip

This update led to a new issue (see stacktrace attachement):

stacktrace.txt

I had to update the 'gradle.build' file to use a new specification for the JDK and remove the force attribute for the mime pull dependency. (see file attachement with the new build file, change the file ending to .gradle again)

build.txt

Then the build worked with a JDK20 and Gradle 8.10.
But when starting the main class 'LakesideMutualContextMapDiscoverer' I received the following exception:

exception.txt

@stefan-ka
Copy link
Member

Hi @j-ruch

Sorry, I totally forgot about the LakesideMutual example. I updated Gradle now and for me, at least with Java 11, it seams to work again. The main() still fails with some formatting exceptions but at least it produces a CML-file. Sorry, thats what I can do today... There are still issues to be solved for newer Java versions and with the CML formatting. But maybe you can also generate a CML file now?

Best regards,
Stefan

@j-ruch
Copy link

j-ruch commented Aug 29, 2024

Hi @stefan-ka
It worked just like you explained, I also receive the CML files and an issue in the console.
I guess you could close this issue...

It would be great if you would find the time to fix the setup entirely somewhen. In case you need any further help, you can send me a message to verify it on my end.
Thanks again for the great support, big thumbs up 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants