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

0
8 comments

The issue is not clear. What is the error? Please share the reproducible test case: https://uploads.jetbrains.com .

0
Avatar
Permanently deleted user

How I can do that?

Unfortunately, This Is Professional and my code is confidential...

 

0

See https://stackoverflow.com/help/mcve . You can make a dummy reproducible sample with no proprietary code.

0
Avatar
Permanently deleted user

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.

import io.vertx.core.Verticle

interface SunService : Verticle {
val name: String
}

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

com.service.authnz.ServiceAuthnz

Here is the configuration file :


/**
* Base and global property of any service
*
* Any value marked with `Mandatory : false` can be completly ommited or set to `null` value.
* If such value is ommited then the default value is applied.
*/
data class LauncherConfiguration(
/**
* Enable or disable development mode.
* Dev mode print server stack strace on client and enable coroutine debug probe
*
* Mandatory : false
* Default : false
*/
val devmode: Boolean,

/**
* Customize logger configuration
*
* Mandatory : false
* Default : @see default logger configuration values
*/
val logger: LoggerConfig?,

/**
* Cluster configuration.
* All sunservice node is the same logical cluster must share the same configuration.
*
* If null, then start vertx in local mode.
*
* Mandatory : false
* Default : null
*/
val cluster: ClusterConfig?,

/**
* Services to load with configuration
*
* Mandatory : true
*/
val services: Map<String, ServiceDeployement>
) {
data class ServiceDeployement(val instances: Int, val config: ObjectNode?)
}

When it works (with the version 2019.3.5 all services ares deployed as below :

20:26:36.895 [INFO ] [vert.x-worker-thread-0 ] com.hazelcast.core.LifecycleService - [192.168.1.101]:5701 [dev-cluster] [3.12.2] [192.168.1.101]:5701 is STARTED
20:26:38.023 [INFO ] [vert.x-worker-thread-3 ] c.h.internal.partition.impl.PartitionStateManager - [192.168.1.101]:5701 [dev-cluster] [3.12.2] Initializing cluster partition table arrangement...
20:26:38.474 [INFO ] [.x-eventloop-thread-5 @coroutine#17] com.service.io.ServiceIO - Deploying
20:26:38.474 [INFO ] [.x-eventloop-thread-3 @coroutine#14] com.service.cockpit.ServiceCockpit - Deploying
20:26:38.474 [INFO ] [.x-eventloop-thread-1 @coroutine#15] com.service.authnz.ServiceAuthnz - Deploying
20:26:38.476 [INFO ] [.x-eventloop-thread-2 @coroutine#12] com.service.build.ServiceBuild - Deploying
20:26:38.476 [INFO ] [.x-eventloop-thread-4 @coroutine#11] com.service.model.ServiceModel - Deploying
20:26:38.476 [INFO ] [.x-eventloop-thread-0 @coroutine#13] com.service.workflow.ServiceWorkflow - Deploying
20:26:38.476 [INFO ] [.x-eventloop-thread-6 @coroutine#10] c.a.s.s.projectionazbatch.ServiceProjectionazbatch - Deploying
20:26:38.476 [INFO ] [.x-eventloop-thread-7 @coroutine#16] c.service.restpublication.ServiceRest - Deploying
20:26:38.718 [INFO ] [.x-eventloop-thread-3 @coroutine#14] com.service.cockpit.ServiceCockpit - Deployed
20:26:38.728 [INFO ] [ltDispatcher-worker-1 @coroutine#11] org.flywaydb.core.internal.license.VersionPrinter - Flyway Community Edition 6.2.0 by Redgate
TODO: apply blacklist, or only loaded in function of config
20:26:39.108 [INFO ] [.x-eventloop-thread-7 @coroutine#16] c.service.restpublication.ServiceRest - Starting openapi route provider class com.service.authnz.rest.ServiceAuthnzOpenapiProvider

When it doesnt (version 2020.3.1) it gives me this:

20:31:27.310 [INFO ] [vert.x-worker-thread-0 ] com.hazelcast.core.LifecycleService - [192.168.1.101]:5702 [-dev-cluster] [3.12.2] [192.168.1.101]:5702 is STARTED
20:31:28.257 [WARN ] [main @coroutine#1 ] com.base.service.Bootstrap - No service registered for name 'service-authnz', skipping, it will not be started
20:31:28.258 [WARN ] [main @coroutine#1 ] com.base.service.Bootstrap - No service registered for name 'service-build', skipping, it will not be started
20:31:28.258 [WARN ] [main @coroutine#1 ] com.base.service.Bootstrap - No service registered for name 'service-cockpit', skipping, it will not be started
20:31:28.258 [WARN ] [main @coroutine#1 ] com.base.service.Bootstrap - No service registered for name 'service-model', skipping, it will not be started
20:31:28.258 [WARN ] [main @coroutine#1 ] com.base.service.Bootstrap - No service registered for name 'service-io', skipping, it will not be started
20:31:28.258 [WARN ] [main @coroutine#1 ] com.base.service.Bootstrap - No service registered for name 'service-projectionazbatch', skipping, it will not be started
20:31:28.258 [WARN ] [main @coroutine#1 ] com.base.service.Bootstrap - No service registered for name 'openapi-http-server', skipping, it will not be started
20:31:28.258 [WARN ] [main @coroutine#1 ] com.base.service.Bootstrap - No service registered for name 'service-workflow', skipping, it will not be started
20:31:28.258 [ERROR] [main @coroutine#1 ] com.base.service.Bootstrap - No services will be deployed. A vertx instance without any service doesn't service any purpose
20:31:28.260 [ERROR] [main @coroutine#1 ] com.base.service.Bootstrap - Exit with status NO_SERVICE_TO_DEPLOY(50)
20:31:28.260 [INFO ] [Thread-6 ] com..ase.service.Bootstrap - Closing vertx

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

 

 

 

0

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.

0
Avatar
Permanently deleted user

I cannot do that cause of the privacy of code.

 

But when I put intellij instead of gradle in the settings it works :

 

0

Unfortunately, we can't investigate it further without a reproducible test case.

0
Avatar
Permanently deleted user

I understand no problem.
I lll try to find out by myself

0

Please sign in to leave a comment.