Costum distribution

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Costum distribution

Filippo Balicchia-2
Hello I am trying to build my costum distribution but at the moment to
launch karaf get the following error

Could not create framework: java.io.FileNotFoundException:
/home/fbalicchia/projects/mykaraf/target/mycustom-karaf-1.0/org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar

Can you tell me what I forgot ?

Cheers


--Filippo


My bin.xml looks like this.
--from here--
<assembly>
    <id>bin</id>
    <formats>
        <format>tar.gz</format>
    </formats>

    <fileSets>

        <!-- Expanded Karaf Standard Distribution -->
        <fileSet>
            <directory>target/dependencies/apache-karaf-2.2.4</directory>
            <outputDirectory>/</outputDirectory>
            <excludes>
                <exclude>**/demos/**</exclude>
                <exclude>bin/**</exclude>
                <exclude>etc/system.properties</exclude>
                <exclude>etc/users.properties</exclude>
                <exclude>etc/org.apache.karaf.features.cfg</exclude>
                <exclude>etc/org.ops4j.pax.logging.cfg</exclude>
                <exclude>LICENSE</exclude>
                <exclude>NOTICE</exclude>
                <exclude>README</exclude>
                <exclude>RELEASE-NOTES</exclude>
                <exclude>karaf-manual*.html</exclude>
                <exclude>karaf-manual*.pdf</exclude>
            </excludes>
        </fileSet>

        <!-- Copy over bin/* separately to get the correct file mode -->
        <fileSet>
            <directory>target/dependencies/apache-karaf-2.2.4</directory>
            <outputDirectory>/</outputDirectory>
            <includes>
                <include>bin/admin</include>
                <include>bin/karaf</include>
                <include>bin/start</include>
                <include>bin/stop</include>
            </includes>
            <fileMode>0755</fileMode>
        </fileSet>

        <!-- Copy over jar files -->
        <fileSet>
            <directory>target/dependencies</directory>
            <includes>
                <include>my-custom.jar</include>
            </includes>
            <outputDirectory>/lib/</outputDirectory>
        </fileSet>

        <fileSet>
            <directory>src/main/distribution</directory>
            <outputDirectory>/</outputDirectory>
            <fileMode>0644</fileMode>
        </fileSet>
        <fileSet>
            <directory>target/classes/etc</directory>
            <outputDirectory>/etc/</outputDirectory>
            <lineEnding>unix</lineEnding>
            <fileMode>0644</fileMode>
        </fileSet>

        <fileSet>
            <directory>target/features-repo</directory>
            <outputDirectory>/system</outputDirectory>
        </fileSet>

    </fileSets>

    <files>
        <file>
            <source>/home/fbalicchia/projects/mykaraf/target/dependencies/apache-karaf-2.2.4/bin/karaf</source>
            <outputDirectory>/bin/</outputDirectory>
            <destName>my-custom</destName>
            <fileMode>0755</fileMode>
            <lineEnding>unix</lineEnding>
        </file>
    </files>
</assembly>
--to here--

my pom.xml

--from here --
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
  <groupId>my.company</groupId>
  <artifactId>mycustom-karaf</artifactId>
  <version>1.0</version>
  <packaging>pom</packaging>
  <name>My Unix Custom Karaf Distribution</name>

  <properties>
    <karaf.version>2.2.4</karaf.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.karaf</groupId>
      <artifactId>apache-karaf</artifactId>
      <version>2.2.4</version>
      <type>tar.gz</type>
    </dependency>
    <dependency>
      <groupId>org.apache.karaf.assemblies.features</groupId>
      <artifactId>standard</artifactId>
      <version>2.2.4</version>
      <type>xml</type>
      <classifier>features</classifier>
    </dependency>
    <dependency>
      <groupId>org.apache.karaf.assemblies.features</groupId>
      <artifactId>enterprise</artifactId>
      <version>2.2.4</version>
      <type>xml</type>
      <classifier>features</classifier>
    </dependency>

  </dependencies>

   <repositories>
        <!-- Required to allow building with a snapshot of the NMR
(parent POM) -->
        <repository>
            <id>apache.snapshots</id>
            <name>Apache Snapshot Repository</name>
            <url>http://repository.apache.org/snapshots</url>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
        <!-- Java.net Maven Repository, required by javax.mail -->
        <repository>
            <id>java.net</id>
            <name>Java.net Maven2 Repository</name>
            <url>http://download.java.net/maven/2</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- JBoss Maven Repository, required by Drools -->
        <repository>
            <id>jboss</id>
            <name>JBoss Maven2 Repository</name>
            <url>http://repository.jboss.com/nexus/content/groups/public/</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- Scriptengines Google Maven Repository, required by
scriptengines -->
        <repository>
            <id>scriptengines</id>
            <name>Scriptengines Google Code Maven Repository</name>
            <url>http://scriptengines.googlecode.com/svn/m2-repo</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
        <!-- ServiceMix Maven 2 repository: jsmpp 2.0 is not in central repo -->
        <repository>
            <id>servicemix.m2-repo</id>
            <name>ServiceMix Maven 2 repository</name>
            <url>http://svn.apache.org/repos/asf/servicemix/m2-repo</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

<build>
    <resources>
      <resource>
        <directory>${basedir}/src/main/filtered-resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*</include>
        </includes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
          <execution>
            <id>filter</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.karaf.tooling</groupId>
        <artifactId>features-maven-plugin</artifactId>
        <version>2.2.2</version>
        <executions>
          <execution>
           <id>add-features-to-repo</id>
           <phase>generate-resources</phase>
           <goals>
             <goal>add-features-to-repo</goal>
           </goals>
           <configuration>
              <descriptors>

<descriptor>mvn:org.apache.karaf.assemblies.features/standard/2.2.4/xml/features</descriptor>
                <descriptor>mvn:org.apache.karaf.assemblies.features/enterprise/2.2.4/xml/features</descriptor>
                <!-- descriptor>/home/fbalicchia/projects/mykaraf/target/classes/my-features.xml</descriptor-->
              </descriptors>
              <features>
                 <feature>config</feature>
              </features>
           </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>copy</goal>
            </goals>
            <configuration>
               <!-- Define here the artifacts which should be
considered in the assembly -->
               <!-- For instance, the branding jar -->
               <artifactItems>
                 <artifactItem>
                    <groupId>org.apache.servicemix.features</groupId>

<artifactId>org.apache.servicemix.features.branding</artifactId>
                    <version>4.4.0-SNAPSHOT</version>
                    <outputDirectory>target/dependencies</outputDirectory>
                    <destFileName>mybranding.jar</destFileName>
                 </artifactItem>
               </artifactItems>
            </configuration>
          </execution>
          <execution>
            <!-- Uncompress the standard Karaf distribution -->
            <id>unpack</id>
            <phase>generate-resources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.karaf</groupId>
                  <artifactId>apache-karaf</artifactId>
                  <type>tar.gz</type>
                  <outputDirectory>target/dependencies</outputDirectory>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>bin</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <descriptors>
                <descriptor>src/main/descriptors/bin.xml</descriptor>
              </descriptors>
              <appendAssemblyId>false</appendAssemblyId>
              <tarLongFileMode>gnu</tarLongFileMode>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>


--to here--
Reply | Threaded
Open this post in threaded view
|

Re: Costum distribution

seijoed
To add the dependency for org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar

On Nov 22, 2011, at 10:46 AM, Filippo Balicchia wrote:

> Hello I am trying to build my costum distribution but at the moment to
> launch karaf get the following error
>
> Could not create framework: java.io.FileNotFoundException:
> /home/fbalicchia/projects/mykaraf/target/mycustom-karaf-1.0/org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar
>
> Can you tell me what I forgot ?
>
> Cheers
>
>
> --Filippo
>
>
> My bin.xml looks like this.
> --from here--
> <assembly>
>    <id>bin</id>
>    <formats>
>        <format>tar.gz</format>
>    </formats>
>
>    <fileSets>
>
>        <!-- Expanded Karaf Standard Distribution -->
>        <fileSet>
>            <directory>target/dependencies/apache-karaf-2.2.4</directory>
>            <outputDirectory>/</outputDirectory>
>            <excludes>
>                <exclude>**/demos/**</exclude>
>                <exclude>bin/**</exclude>
>                <exclude>etc/system.properties</exclude>
>                <exclude>etc/users.properties</exclude>
>                <exclude>etc/org.apache.karaf.features.cfg</exclude>
>                <exclude>etc/org.ops4j.pax.logging.cfg</exclude>
>                <exclude>LICENSE</exclude>
>                <exclude>NOTICE</exclude>
>                <exclude>README</exclude>
>                <exclude>RELEASE-NOTES</exclude>
>                <exclude>karaf-manual*.html</exclude>
>                <exclude>karaf-manual*.pdf</exclude>
>            </excludes>
>        </fileSet>
>
>        <!-- Copy over bin/* separately to get the correct file mode -->
>        <fileSet>
>            <directory>target/dependencies/apache-karaf-2.2.4</directory>
>            <outputDirectory>/</outputDirectory>
>            <includes>
>                <include>bin/admin</include>
>                <include>bin/karaf</include>
>                <include>bin/start</include>
>                <include>bin/stop</include>
>            </includes>
>            <fileMode>0755</fileMode>
>        </fileSet>
>
>        <!-- Copy over jar files -->
>        <fileSet>
>            <directory>target/dependencies</directory>
>            <includes>
>                <include>my-custom.jar</include>
>            </includes>
>            <outputDirectory>/lib/</outputDirectory>
>        </fileSet>
>
>        <fileSet>
>            <directory>src/main/distribution</directory>
>            <outputDirectory>/</outputDirectory>
>            <fileMode>0644</fileMode>
>        </fileSet>
>        <fileSet>
>            <directory>target/classes/etc</directory>
>            <outputDirectory>/etc/</outputDirectory>
>            <lineEnding>unix</lineEnding>
>            <fileMode>0644</fileMode>
>        </fileSet>
>
>        <fileSet>
>            <directory>target/features-repo</directory>
>            <outputDirectory>/system</outputDirectory>
>        </fileSet>
>
>    </fileSets>
>
>    <files>
>        <file>
>            <source>/home/fbalicchia/projects/mykaraf/target/dependencies/apache-karaf-2.2.4/bin/karaf</source>
>            <outputDirectory>/bin/</outputDirectory>
>            <destName>my-custom</destName>
>            <fileMode>0755</fileMode>
>            <lineEnding>unix</lineEnding>
>        </file>
>    </files>
> </assembly>
> --to here--
>
> my pom.xml
>
> --from here --
> <?xml version="1.0" encoding="UTF-8"?>
> <project xmlns="http://maven.apache.org/POM/4.0.0"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://maven.apache.org/POM
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
> <modelVersion>4.0.0</modelVersion>
>  <groupId>my.company</groupId>
>  <artifactId>mycustom-karaf</artifactId>
>  <version>1.0</version>
>  <packaging>pom</packaging>
>  <name>My Unix Custom Karaf Distribution</name>
>
>  <properties>
>    <karaf.version>2.2.4</karaf.version>
>  </properties>
>
>  <dependencies>
>    <dependency>
>      <groupId>org.apache.karaf</groupId>
>      <artifactId>apache-karaf</artifactId>
>      <version>2.2.4</version>
>      <type>tar.gz</type>
>    </dependency>
>    <dependency>
>      <groupId>org.apache.karaf.assemblies.features</groupId>
>      <artifactId>standard</artifactId>
>      <version>2.2.4</version>
>      <type>xml</type>
>      <classifier>features</classifier>
>    </dependency>
>    <dependency>
>      <groupId>org.apache.karaf.assemblies.features</groupId>
>      <artifactId>enterprise</artifactId>
>      <version>2.2.4</version>
>      <type>xml</type>
>      <classifier>features</classifier>
>    </dependency>
>
>  </dependencies>
>
>   <repositories>
>        <!-- Required to allow building with a snapshot of the NMR
> (parent POM) -->
>        <repository>
>            <id>apache.snapshots</id>
>            <name>Apache Snapshot Repository</name>
>            <url>http://repository.apache.org/snapshots</url>
>            <releases>
>                <enabled>false</enabled>
>            </releases>
>        </repository>
>        <!-- Java.net Maven Repository, required by javax.mail -->
>        <repository>
>            <id>java.net</id>
>            <name>Java.net Maven2 Repository</name>
>            <url>http://download.java.net/maven/2</url>
>            <releases>
>                <enabled>true</enabled>
>            </releases>
>            <snapshots>
>                <enabled>false</enabled>
>            </snapshots>
>        </repository>
>        <!-- JBoss Maven Repository, required by Drools -->
>        <repository>
>            <id>jboss</id>
>            <name>JBoss Maven2 Repository</name>
>            <url>http://repository.jboss.com/nexus/content/groups/public/</url>
>            <releases>
>                <enabled>true</enabled>
>            </releases>
>            <snapshots>
>                <enabled>false</enabled>
>            </snapshots>
>        </repository>
>        <!-- Scriptengines Google Maven Repository, required by
> scriptengines -->
>        <repository>
>            <id>scriptengines</id>
>            <name>Scriptengines Google Code Maven Repository</name>
>            <url>http://scriptengines.googlecode.com/svn/m2-repo</url>
>            <releases>
>                <enabled>true</enabled>
>            </releases>
>            <snapshots>
>                <enabled>false</enabled>
>            </snapshots>
>        </repository>
>        <!-- ServiceMix Maven 2 repository: jsmpp 2.0 is not in central repo -->
>        <repository>
>            <id>servicemix.m2-repo</id>
>            <name>ServiceMix Maven 2 repository</name>
>            <url>http://svn.apache.org/repos/asf/servicemix/m2-repo</url>
>            <releases>
>                <enabled>true</enabled>
>            </releases>
>            <snapshots>
>                <enabled>false</enabled>
>            </snapshots>
>        </repository>
>    </repositories>
>
> <build>
>    <resources>
>      <resource>
>        <directory>${basedir}/src/main/filtered-resources</directory>
>        <filtering>true</filtering>
>        <includes>
>          <include>**/*</include>
>        </includes>
>      </resource>
>    </resources>
>    <plugins>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-resources-plugin</artifactId>
>        <executions>
>          <execution>
>            <id>filter</id>
>            <phase>generate-resources</phase>
>            <goals>
>              <goal>resources</goal>
>            </goals>
>          </execution>
>        </executions>
>      </plugin>
>      <plugin>
>        <groupId>org.apache.karaf.tooling</groupId>
>        <artifactId>features-maven-plugin</artifactId>
>        <version>2.2.2</version>
>        <executions>
>          <execution>
>           <id>add-features-to-repo</id>
>           <phase>generate-resources</phase>
>           <goals>
>             <goal>add-features-to-repo</goal>
>           </goals>
>           <configuration>
>              <descriptors>
>
> <descriptor>mvn:org.apache.karaf.assemblies.features/standard/2.2.4/xml/features</descriptor>
> <descriptor>mvn:org.apache.karaf.assemblies.features/enterprise/2.2.4/xml/features</descriptor>
> <!-- descriptor>/home/fbalicchia/projects/mykaraf/target/classes/my-features.xml</descriptor-->
>              </descriptors>
>              <features>
>                 <feature>config</feature>
>              </features>
>           </configuration>
>          </execution>
>        </executions>
>      </plugin>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-dependency-plugin</artifactId>
>        <executions>
>          <execution>
>            <id>copy</id>
>            <phase>generate-resources</phase>
>            <goals>
>              <goal>copy</goal>
>            </goals>
>            <configuration>
>               <!-- Define here the artifacts which should be
> considered in the assembly -->
>               <!-- For instance, the branding jar -->
>               <artifactItems>
>                 <artifactItem>
>                    <groupId>org.apache.servicemix.features</groupId>
>
> <artifactId>org.apache.servicemix.features.branding</artifactId>
>                    <version>4.4.0-SNAPSHOT</version>
>                    <outputDirectory>target/dependencies</outputDirectory>
>                    <destFileName>mybranding.jar</destFileName>
>                 </artifactItem>
>               </artifactItems>
>            </configuration>
>          </execution>
>          <execution>
>            <!-- Uncompress the standard Karaf distribution -->
>            <id>unpack</id>
>            <phase>generate-resources</phase>
>            <goals>
>              <goal>unpack</goal>
>            </goals>
>            <configuration>
>              <artifactItems>
>                <artifactItem>
>                  <groupId>org.apache.karaf</groupId>
>                  <artifactId>apache-karaf</artifactId>
>                  <type>tar.gz</type>
>                  <outputDirectory>target/dependencies</outputDirectory>
>                </artifactItem>
>              </artifactItems>
>            </configuration>
>          </execution>
>        </executions>
>      </plugin>
>      <plugin>
>        <groupId>org.apache.maven.plugins</groupId>
>        <artifactId>maven-assembly-plugin</artifactId>
>        <executions>
>          <execution>
>            <id>bin</id>
>            <phase>package</phase>
>            <goals>
>              <goal>single</goal>
>            </goals>
>            <configuration>
>              <descriptors>
>                <descriptor>src/main/descriptors/bin.xml</descriptor>
>              </descriptors>
>              <appendAssemblyId>false</appendAssemblyId>
>              <tarLongFileMode>gnu</tarLongFileMode>
>            </configuration>
>          </execution>
>        </executions>
>      </plugin>
>    </plugins>
>  </build>
> </project>
>
>
> --to here--

Reply | Threaded
Open this post in threaded view
|

Re: Costum distribution

iocanel
From a first glance your approach looks sane to me. It reminds me the service-mix packaging and it should work.

Now the problem you are having is that it can't find the felix jar. I see that it tries to find the file right inside your distribution home, while it should try to find it under the system folder.
i) Check that the file is properly located at : distro home under: system/org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar
ii) Check that in your system.properties file ${karaf.default.repository} properly points to the system folder.

My guess is that you don't have a system.properties file at all and that this is the root cause of all your problems.

Have fun!

--
Ioannis Canellos

Apache Karaf Committer & PMC
Apache Camel Committer
Apache ServiceMix  Committer
Apache Gora Committer





Ioannis Canellos
http://iocanel.blogspot.com
Reply | Threaded
Open this post in threaded view
|

Re: Costum distribution

Filippo Balicchia-2
Thanks Ioannis,

i'm following the
http://karaf.apache.org/manual/latest-2.2.x/developers-guide/custom-distribution.html
and i suppose that is the same approch that servicemix use.
The problem was that i forget to create thet etc folder ;-)

Thanks

--Filippo




Il 24 novembre 2011 11:35, Ioannis Canellos <[hidden email]> ha scritto:

> From a first glance your approach looks sane to me. It reminds me
> the service-mix packaging and it should work.
> Now the problem you are having is that it can't find the felix jar. I see
> that it tries to find the file right inside your distribution home, while it
> should try to find it under the system folder.
> i) Check that the file is properly located at : distro home under:
> system/org/apache/felix/org.apache.felix.framework/3.0.9/org.apache.felix.framework-3.0.9.jar
> ii) Check that in your system.properties file ${karaf.default.repository}
> properly points to the system folder.
> My guess is that you don't have a system.properties file at all and that
> this is the root cause of all your problems.
> Have fun!
>
> --
> Ioannis Canellos
> FuseSource
>
> Blog: http://iocanel.blogspot.com
> Apache Karaf Committer & PMC
> Apache Camel Committer
> Apache ServiceMix  Committer
> Apache Gora Committer
> Apache DirectMemory Committer
>
>
>
>
>