Uploaded image for project: 'Karaf'
  1. Karaf
  2. KARAF-2388

Error "No karaf base dir found in extracted distribution." when using customized Karaf distribution

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Not A Problem
    • 2.3.2, 3.0.0.RC1
    • None
    • karaf
    • None

    Description

      Following the manual at http://karaf.apache.org/manual/latest-2.3.x/developers-guide/writing-tests.html#KarafDistributionConfigurationOption I tried to write integration tests based on a custom Karaf distribution.
      I used the following to configure the container:

      ...
      karafDistributionConfiguration()
      	.frameworkUrl(
      			maven()
      			.groupId("at.ac.ait.hbs.homer")
      			.artifactId("at.ac.ait.hbs.homer.core.distribution.assemblies.stable")
      			.type("zip")
      			.versionAsInProject()
      	)
      	.karafVersion(KARAF_VERSION)
      	.name("Apache Karaf")
      	.unpackDirectory(new File(UNPACK_DIRECTORY)),
      ...
      

      When running the tests I get an "No karaf base dir found in extracted distribution." error. When looking into the "target\exam\<random>\" folder (= UNPACK_DIRECTORY) there is really a mess:

      DISCLAIMER.txt
      LICENSE.txt
      README.txt
      ...
      bin\
      ...
      config.properties
      custom.properties
      endorsed\
      ext\
      ...
      karaf.bat
      karaf.jar
      keys.properties
      org\
      ...
      system.properties
      tmp\
      users.properties
      

      What I expected was the default Karaf distribution layout:

      bin\
      data\
      demo\
      deploy\
      etc\
      lib\
      system\
      README
      karaf-manual-2.3.2.html
      karaf-manual-2.3.2.pdf
      ...
      

      Digging into the problem I found out that the eg. the apache-karaf-2.3.2.zip looks like:

      apache-karaf-2.3.2\bin\
      apache-karaf-2.3.2\data\
      apache-karaf-2.3.2\demo\
      apache-karaf-2.3.2\deploy\
      apache-karaf-2.3.2\etc\
      apache-karaf-2.3.2\lib\
      apache-karaf-2.3.2\system\
      apache-karaf-2.3.2\README
      apache-karaf-2.3.2\karaf-manual-2.3.2.html
      apache-karaf-2.3.2\karaf-manual-2.3.2.pdf
      ...
      

      Whereas the custom distribution I'm using looks like:

      bin\
      data\
      demo\
      deploy\
      etc\
      lib\
      system\
      README
      karaf-manual-2.3.2.html
      karaf-manual-2.3.2.pdf
      ...
      

      Note the different "base" directory in the two packages - "apache-karaf-2.3.2" in case of the Karaf 2.3.2 assembly.
      It seems that the container assumes that every zip/tar.gz file given has this "base" directory structure and extracts only the contents of subfolders to the unpack directory.

      I think a check for this "base" directory should be integrated in the container and either extract only the contents in this "base" directory or extract the whole file otherwise - the base directory seems to have the same name as the artifact name?!

      If you want to try it out you can get the distribution from http://dev.arcsmed.at/nexus/content/repositories/homer.core-snapshots/at/ac/ait/hbs/homer/at.ac.ait.hbs.homer.core.distribution.assemblies.stable/1.2.0-SNAPSHOT/

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jbonofre Jean-Baptiste Onofré
            roedll Lukas Roedl
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment