Java 在Karaf特征中启动零部件

Java 在Karaf特征中启动零部件,java,osgi,apache-felix,apache-karaf,karaf,Java,Osgi,Apache Felix,Apache Karaf,Karaf,我正在尝试部署一个与名为“utils”的组件具有依赖关系的功能。该组件是作为如下功能添加的: <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</bundl

我正在尝试部署一个与名为“utils”的组件具有依赖关系的功能。该组件是作为如下功能添加的:

<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>
问题是我不知道哪个包有
sun.awt
。我有一个填充物,不是为了找到这个人工制品,这里还有另一个问题

有人有主意吗

更新 Alexander询问捆绑包是如何生成的,下面是maven pom:

注意:如果有人想要有效的pom,请告诉我,但这将是巨大的。这就是为什么我既没有发布pom.xml,也没有发布有效的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>

eu.linksmart.gc
eu.linksmart.gc.osgi.component
0.3.0-快照
4.0.0
乌提尔斯
${linksmart.gc.version}
几个乌提尔
捆
org.eclipse.paho.client.mqttv3
org.eclipse.paho
1.0.2
共用配置
共用配置
1.10
公地小海狸
公地小海狸
1.9.2
org.apache.commons
commons-lang3
3.1
org.slf4j
slf4j api
泛美卫生组织报告
https://repo.eclipse.org/content/repositories/paho-releases/
jboss-maven2-release-repository
https://repository.jboss.org/nexus/content/groups/public/
阿帕奇
https://linksmart.eu/repo/content/repositories/apache-snapshots/
org.codehaus.mojo
构建助手maven插件
附加工件
包裹
附加工件
src/main/resources/conf.cfg
cfg
配置
org.apache.felix
maven捆绑插件
2.4.0
真的
${project.artifactId}
org.apache.maven.plugins
maven编译器插件
1.7
1.7

sun.awt是来自JRE的一个包,karaf不会自动使用它。您可以修改$KARAF_ETC/jre.properties,并在jre中添加一行,用于指定KARAF,以提供更多的jre包


我印象深刻。但是没有起作用。在
包:exports
中未显示,并且消息error仍然存在。您是否确实需要运行时的
sun.awt
类?您是自己构建
utils
还是第三方库?如果您不需要sun.awt,并且这是您自己的代码,那么您应该修复utils包的导入。抱歉,我没有看到您的消息。是的,这是我自己的代码,是的,我不需要sun.awt。但是bundle说它需要如果它是你的代码并且你在控制中,为什么你不修复
util
bundle的导入呢?我不作为依赖项导入或添加。不确定约束来自何处。可能来自某个依赖项。请在问题中添加有关如何构建
util
捆绑包的信息。
<?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>