When I am trying to load the services it is throwing the error.
var factoryClass = java.lang.Class.forName(“com.XXX.YYY.sdk.SdkFactory”);
var serviceLoader = java.util.ServiceLoader.load(factoryClass);
var iterator = serviceLoader.iterator();
log.debug("Has next--------- " + iterator.hasNext()); This line is returning false. It has one element. Instead of true it is returning false.
Could some one help to load the custom services in camunda.
Please find my below comments
What are you trying to do?
We are trying to load the services. With our non camuda flow the iterator.hasNext() is returning true. With camunda engine it is returning false. After loading the services, we are calling getXXXX method to achieve some business logic wrto some service operation that is not happening in camunda.
What are you expecting to happen?
What is actually happening
As mentioned in descripton we are trying to load the services and trying to use this in camunda as rhino script. var factoryClass = java.lang.Class.forName(“com.XXX.YYY.sdk.SdkFactory”); var serviceLoader = java.util.ServiceLoader.load(factoryClass);
In our code, we are iterating this service loader.In iterator is returing false in camuda but it is returning true in other places than camunda.So we are expecting the service loader should have value for the iterator in camunda engine also. var iterator = serviceLoader.iterator(); The iterator.hasNext() is returning false.
Did it work before : Trying to implement/achieve the same what we can do from non camunda flow.
If so - what has changed since: No.
I tried with existing services also. Example log4j-api-2.17.1.jar\META-INF\services\org.apache.logging.log4j.util.PropertySource. This as 2 entries ie
org.apache.logging.log4j.util.EnvironmentPropertySource
org.apache.logging.log4j.util.SystemPropertiesPropertySource
When I tried these also, count is coming as 0 in camunda and non camunda count is coming as 2.