Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-16243

camel-restlet : Compatibility issue of camel-restlet with camel-api library resulting in e "NoSuchMethodError:org.apache.camel.CamelContext.getRestConfiguration(Ljava/lang/String;Z)Lorg/apache/camel/spi/RestConfiguration" in RestletComponent class



    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Invalid
    • Affects Version/s: None
    • Fix Version/s: 3.x
    • Component/s: camel-restlet
    • Labels:
    • Environment:

      Open JDK 11.0.2

    • Estimated Complexity:



      Recently we upgraded our Application's overall camel version from 2.16.0 to 3.4.4. We are using several camel components in our applications such as:

      camel-jms, camel-restlet, camel-restlet, cale-zookeeper, camel-file, camel-rest, etc...


      One of the component we used in our Application was camel-restlet component (version 2.16.0) where after migration to camel 3.x, we are facing issue in service start-up.

      Issue #1 : It seems camel removed the restlet component after 3.x. Could not find much documentation which would let us know how to migrate the existing camel-restlet component

      Issue #2 : We gave a try to upgrade the camel-restlet component to 3.0.0-RC2. But during start-up of our service, we faced an error as mentioned in the below stack trace.

      Exception in thread "main" java.lang.NoSuchMethodError: org.apache.camel.CamelContext.getRestConfiguration(Ljava/lang/String;Z)Lorg/apache/camel/spi/RestConfiguration;
              at org.apache.camel.component.restlet.RestletComponent.doStart(RestletComponent.java:215)
              at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
              at org.apache.camel.impl.engine.AbstractCamelContext.startService(AbstractCamelContext.java:3026)
              at org.apache.camel.impl.engine.AbstractCamelContext.startServices(AbstractCamelContext.java:3032)
              at org.apache.camel.impl.engine.AbstractCamelContext.doStartCamel(AbstractCamelContext.java:2759)
              at org.apache.camel.impl.engine.AbstractCamelContext.doStartContext(AbstractCamelContext.java:2658)
              at org.apache.camel.impl.engine.AbstractCamelContext.doStart(AbstractCamelContext.java:2621)
              at org.apache.camel.support.service.BaseService.start(BaseService.java:115)
              at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2453)
              at com.nri.csd.inf.console.service.GatewayService.startCamelContextIfNotStarted(GatewayService.java:201)
              at com.nri.csd.inf.console.service.GatewayService.postStart(GatewayService.java:100)
              at com.nri.csd.inf.console.service.AbstractLaunchableService.start(AbstractLaunchableService.java:216)
              at com.nri.csd.inf.console.ConsoleLauncher.main(ConsoleLauncher.java:96)

      Found in the code that RestletComponent java class in camel-restlet-3.0.0-RC2 version has an API doStart() in which at line 215, there is a call to CamelContext class's method getRestConfiguration("restlet", true) (class in camel-api jar).


      210    @Override
      211    protected void doStart() throws Exception {
      212        super.doStart();        
      214         // configure component options
      215        RestConfiguration config = getCamelContext().getRestConfiguration("restlet", true);
      216        // configure additional options on spark configuration
      217        if (config.getComponentProperties() != null && !config.getComponentProperties().isEmpty()) {
      218            setProperties(this, config.getComponentProperties());
      219        }        
      221           cleanupConverters(enabledConverters);        
      223           component.start();     
      2234   }

      The API called at line 215 above (i.e. getRestConfiguration) seems to be removed from the class org.apache.camel.CamelContext in library camel-api during upgradation to 3.2 from 3.1.

      Refer this https://camel.apache.org/manual/latest/camel-3x-upgrade-guide-3_2.html


      However the above API in org.apache.camel.CamelContext in camel-api-3.0.0-RC2 is modified but I am having a transitive dependency upon camel-api-3.4 library (as we need to use camel-jms component as well) and it seems that both camel-api-3.4.4 and camel-api-3.0.0-RC2 cannot be kept together as it gives me some other error if both these libraries are present in the classpath.

      java.lang.ClassNotFoundException: org.apache.camel.EndpointProducerResolver
              at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
              at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)

      This is because the class org.apache.camel.EndpointProducerResolver is present in camel-api-3.4.4 but not present in camel-api-3.0.0-RC2. 

      So it seems there is some cyclic dependency where I am trapped.

      Please suggest what course of action can be taken for this issue with minimum impact or what is the compatibility of camel-restlet component and camel-api, camel-support libraries. We want all to be compatible with camel 3.4.4 version.




            • Assignee:
              pawanmundhra Pawan Mundhra
            • Votes:
              0 Vote for this issue
              3 Start watching this issue


              • Created: