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

camel-flatpack does not work inside of an OSGi bundle in ServiceMix 4

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • 1.6.0
    • None
    • camel-flatpack
    • None
    • Flatpack 3.1.1
      Fuse ESB 4.1.0.0 (Apache Servicemix)
      Camel 1.6.0.0-fuse

    Description

      The following code will not work under Servicemix, but works fine in standalone Camel:

              FlatpackDataFormat fpdf = new FlatpackDataFormat();
              fpdf.setDefinition(new ClassPathResource("dataspecs/mypzmap.xml"));
              fpdf.setFixed(false);
              fpdf.setDelimiter('|');
              fpdf.setIgnoreFirstRecord(false);
      
              from("activemq:" + incomingQueueName).convertBodyTo(String.class).unmarshal(fpdf).to("activemq:input_to_call");
      

      This NPEs when attempting to unmarshal under SMX 4, but works fine in Camel 1.6.x. I've traced down the problem to this code in Flatpack:

      net/sf/flatpack/util/ParseUtils.java
          public static Properties loadConvertProperties() throws IOException {
              final Properties pzConvertProps = new Properties();
              final URL url = ParserUtils.class.getClassLoader().getResource("fpconvert.properties");
              pzConvertProps.load(url.openStream());
      
              return pzConvertProps;
          }
      

      The classloader under SMX is the bundle's classloader, which (of course) cannot find fpconvert.properties, which makes url null, and then causes pzConvertProps.load(...) to raise an NPE.

      I know that this isn't strictly a bug in Camel or SMX, but I thought I'd file it here as an action item to either change upstream flatpack or note a possible workaround on the wiki.

      I suspect that this is a problem with all versions of Camel + SMX including the latest version.

      Attachments

        Activity

          People

            njiang Willem Jiang
            smerp Scott Parkerson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: