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

components - Loading resource from classpath should use ClassResolver API

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.13.0
    • None
    • None
    • Unknown

    Description

      See CAMEL-17114

      There are a number of components that load resources from classpath as:

      camel-infinispan/camel-infinispan-common/src/main/java/org/apache/camel/component/infinispan/InfinispanUtil.java:        return Thread.currentThread().getContextClassLoader().getResourceAsStream(uri);
      camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java:            try (InputStream is = this.getClass().getResourceAsStream("/global-camel-routes.xml")) {
      camel-jbpm/src/main/java/org/apache/camel/component/jbpm/server/CamelKieServerExtension.java:        try (InputStream is = classloader.getResourceAsStream("camel-routes.xml")) {
      camel-jira/src/main/java/org/apache/camel/component/jira/oauth/OAuthAsynchronousHttpClientFactory.java:            try (InputStream resourceAsStream = AuthenticationHandler.class.getResourceAsStream(pomProps)) {
      camel-jslt/src/main/java/org/apache/camel/component/jslt/JsltEndpoint.java:                    stream = JsltEndpoint.class.getClassLoader().getResourceAsStream(getResourceUri());
      camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java:            InputStream is = StdSchedulerFactory.class.getClassLoader().getResourceAsStream("org/quartz/quartz.properties");
      camel-schematron/src/main/java/org/apache/camel/component/schematron/processor/ClassPathURIResolver.java:                .getResourceAsStream(rulesDir.concat("/").concat(href));
      camel-schematron/src/main/java/org/apache/camel/component/schematron/processor/TemplatesFactory.java:                InputStream xsl = this.getClass().getClassLoader().getResourceAsStream(path);
      camel-xmlsecurity/src/main/java/org/apache/camel/component/xmlsecurity/api/XmlSignatureHelper.java:        return XmlSignatureHelper.class.getResourceAsStream(path);
      

      Instead we should use ClassResolver API via CamelContext - This has the mehanism to load correctly in different runtimes - standalone, OSGi, spring boot, quarkus etc.

      Attachments

        Issue Links

          Activity

            People

              ramu11 Ramu
              davsclaus Claus Ibsen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: