0

I'm trying to deploy a feature which has a dependency to a component named "utils" the component was added as a feature like this:

<feature name="gc-utils" version="${version}">

        <bundle>mvn:org.eclipse.paho/org.eclipse.paho.client.mqttv3/1.0.2</bundle>
        <bundle>mvn:log4j/log4j/1.2.17</bundle>
        <bundle>mvn:commons-configuration/commons-configuration/1.10</bundle>
        <bundle>mvn:commons-beanutils/commons-beanutils/1.9.2</bundle>
        <bundle>mvn:org.slf4j/slf4j-log4j12/1.7.12</bundle>
        <bundle>mvn:org.apache.commons/commons-lang3/3.1</bundle>
        <bundle>mvn:com.google.code.gson/gson/2.4</bundle>
        <bundle>mvn:org.slf4j/slf4j-api/1.7.12</bundle>
        <bundle>mvn:my.bundle/utils/${version}</bundle>

</feature>

The feature do no starts because is missing the following constraint:

 executing command: Error executing command on bundles:
   Unable to execute command on bundle 118: Unresolved constraint in bundle utils [118]: Unable to resolve 118.0: missing requirement [118.0] osgi.wiring.package; (osgi.wiri
ckage=sun.awt)

The thing is that I have no idea which bundle has sun.awt. I have the filling that is not abut finding this artifact, there is other side issue here.

anyone have an idea?

UPDATE Alexander asked how the bundle is generated, and here is it the maven pom:

NOTE: tel me if anyone want the effective pom but this will be huge. This is why I didn't post neither the pom.xml nor the effective pom.xml

<?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/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
        <groupId>eu.linksmart.gc</groupId>
        <artifactId>eu.linksmart.gc.osgi.component</artifactId>
        <version>0.3.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

        <artifactId>utils</artifactId>
    <version>${linksmart.gc.version}</version>
    <name>Several Utils</name>
    <packaging>bundle</packaging>
    <dependencies>


        <dependency>
            <artifactId>org.eclipse.paho.client.mqttv3</artifactId>
            <groupId>org.eclipse.paho</groupId>
            <version>1.0.2</version>
        </dependency>
        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.10</version>
        </dependency>

        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.9.2</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>


    </dependencies>
    <repositories>
        <repository>
            <id>Eclipse Paho Repo</id>
            <url>https://repo.eclipse.org/content/repositories/paho-releases/</url>
        </repository>

        <repository>
            <id>jboss-maven2-release-repository</id>
            <url>https://repository.jboss.org/nexus/content/groups/public/</url>
        </repository>
        <repository>
            <id>apache</id>
            <url>https://linksmart.eu/repo/content/repositories/apache-snapshots/</url>
        </repository>
    </repositories>
    <build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-artifacts</id>
                    <phase>package</phase>
                    <goals>
                        <goal>attach-artifact</goal>
                    </goals>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <file>src/main/resources/conf.cfg</file>
                                <type>cfg</type>
                                <classifier>configuration</classifier>
                            </artifact>
                        </artifacts>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.4.0</version>
        <extensions>true</extensions>
        <configuration>
            <instructions>
                <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>

            </instructions>
        </configuration>
    </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>

    </plugins>
    </build>

</project>
ender.an27
  • 703
  • 1
  • 13
  • 35
  • Do you actually need the `sun.awt` classes at runtime? Are you building `utils` yourself or is it a 3rd party library? If you do not need sun.awt and if this is your own code, you should fix the imports of the utils bundle. – Ralf Mar 16 '16 at 14:55
  • Sorry, I didn't see your messages. Yes, it is my own code, and yes I don't need sun.awt. But the bundle says it needed – ender.an27 Mar 16 '16 at 15:38
  • 2
    If it is your code and you are in control, why don't you fix the imports of the `util` bundle? – Ralf Mar 16 '16 at 16:05
  • I do not import or add as dependency. Not sure where the constraint comes. Maybe is from one of the dependencies. – ender.an27 Mar 16 '16 at 16:06
  • Please add information to your question about how you build the `util` bundle. – Ralf Mar 16 '16 at 16:16
  • Same thing as before. Fix your bundle's imports if they are not needed at runtime or add the required sun packages to the boot class loader as Jonathan explained in his answer. – Ralf Mar 16 '16 at 16:27
  • The jonathan fix do not work. I added in the jre.properties file and the package is not loaded – ender.an27 Mar 17 '16 at 08:04
  • Can you post the "my.bundle/util" MANIFEST.MF ? How is the MANIFEST.MF file generated ? Home mode, bnd, felix maven plugin ? – Alexandre Cartapanis Mar 18 '16 at 10:18
  • @AlexandreCartapanis I post it in the update – ender.an27 Mar 21 '16 at 12:51
  • Can you also post the MANIFEST.MF content please ? – Alexandre Cartapanis Mar 22 '16 at 15:15

1 Answers1

0

sun.awt is a package from the JRE that karaf doesn't use automatically. You can modify your $KARAF_ETC/jre.properties and add a line in the jre you use to speciy karaf to provide more jre packages.

You can find a similar resolution here

Jonathan Schoreels
  • 1,660
  • 1
  • 12
  • 20