Service are not launching (micro services) depending of the intellij version
Answered
Hello
I have a reallu weird problems with intellij version.
I have exactly the same project between 2 differents version of intellij and it is working for one(2019.3.5) but not for the last one(2020.3.1) Community edition.
Here is the code which launch all my services :
val availableServices = ServiceLoader.load(SomeService::class.java).map { it.name to it }.toMap()
val servicesWithConfiguration = config.services.flatMap { (serviceName, serviceDeployement) ->
when (val serviceInstance = availableServices[serviceName]) {
null -> {
LOGGER.warn("No service registered for name '$serviceName', skipping, it will not be started")
emptyList()
}
else -> listOf(serviceInstance to serviceDeployement)
}
}
Here is my VM options :
--add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/management=ALL-UNNAMED --add-opens jdk.management/com.management.internal=ALL-UNNAMED
Thanks a lot for the help.
Regards
Please sign in to leave a comment.
The issue is not clear. What is the error? Please share the reproducible test case: https://uploads.jetbrains.com .
How I can do that?
Unfortunately, This Is Professional and my code is confidential...
See https://stackoverflow.com/help/mcve . You can make a dummy reproducible sample with no proprietary code.
Here is the bootstrap main file which call all services.
val availableServices = ServiceLoader.load(SunService::class.java).map { it.name to it }.toMap()val servicesWithConfiguration = config.services.flatMap { (serviceName, serviceDeployement) ->
when (val serviceInstance = availableServices[serviceName]) {
null -> {
LOGGER.warn("No service registered for name '$serviceName', skipping, it will not be started")
emptyList()
}
else -> listOf(serviceInstance to serviceDeployement)
}
}
Here is the interfarce which make the link.
And the final Service (We have 8 of theml):
class ServiceAuthnz : CoroutineVerticle(), SunService {
override val name: String = Companion.name
override suspend fun start() {
....
withe a resource file in resources/META-INF/services
Here is the configuration file :
When it works (with the version 2019.3.5 all services ares deployed as below :
When it doesnt (version 2020.3.1) it gives me this:
This is exactly the same repos on the same github with the 11.0.9 java version, the same gradle.
So it there any changes that came in intelij for the configuration that I didn't see?
We are working on micro services kotlin vertx and coroutines.
My colleague get the same issues even with the version 2019.3.5 this is totally random.
Thanks for reading.
Regards
Please file a bug at https://youtrack.jetbrains.com/newIssue?project=IDEA. Zip and attach the directory with the sample project that we can use to reproduce the issue. Thank you.
I cannot do that cause of the privacy of code.
But when I put intellij instead of gradle in the settings it works :
Unfortunately, we can't investigate it further without a reproducible test case.
I understand no problem.
I lll try to find out by myself