We have recently upgraded our production environment from Karaf 3 to Karaf 4.1.4. Everything seems to be fine in production. But we are facing issue when upgrading our "pax-exam" to use Karaf 4.1.4. After upgrading , our test suit is always inconsistent. Simply put, we are not able to make a REST call. Getting "Connection refused" error. On debugging more we found the port is not listening and that the CONNECTION is not established between our application and the Karaf container. Test suit fails 6 out of 10 times because of this issue. How to resolve this inconsistency ? Why is the port not getting binded sometimes ?
Note: No issues with Firewall / security
More Details :
Karaf version - 4.1.4
org.ops4j.pax.exam version - 4.11.0
Jetty server version - 9.3.21.v20170918
org.ops4j.pax.web version - 6.0.9
org.glassfish.jersey.version - 2.25.1
Once the container starts , all the bundles are up and ACTIVE and all the features are in STARTED state. We then fetch the customized port (available port) and update the corresponding osgi properties. But the update is not successful and getting the below error.
2018-06-05 13:53:39,065 ERROR [Activator.java:380] Unable to start pax web server: null - o.o.p.w.s.i.Activator java.lang.NullPointerException: null at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl$Stopped.start(ServerControllerImpl.java:527) at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl.start(ServerControllerImpl.java:81) at org.ops4j.pax.web.service.jetty.internal.ServerControllerFactoryImpl$1.start(ServerControllerFactoryImpl.java:164) at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl$Unconfigured.configure(ServerControllerImpl.java:787) at org.ops4j.pax.web.service.jetty.internal.ServerControllerImpl.configure(ServerControllerImpl.java:97) at org.ops4j.pax.web.service.internal.Activator.updateController(Activator.java:347) at org.ops4j.pax.web.service.internal.Activator.lambda$scheduleUpdateConfig$1(Activator.java:287) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)