java - 使用 Spring OSGi 时,BundleActivator 无法解析为类型

标签 java spring osgi osgi-bundle

我正在尝试使用 Spring 动态模块来使用 OSGi。下面是我的 pom.xml。我猜我已经添加了与 OSGi 框架相关的所有依赖项,但仍然不知何故,我总是遇到以下异常 -

BundleActivator cannot be resolved to a type

ServiceRegistration cannot be resolved to a type

下面是我的 pom.xml 文件 -

<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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.spring.osgi.example</groupId>
    <artifactId>HelloWorldService</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>HelloWorldService</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.osgi</groupId>
            <artifactId>spring-osgi-core</artifactId>
            <version>1.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.osgi</groupId>
            <artifactId>spring-osgi-extender</artifactId>
            <version>1.2.1</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.2.3.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
            <version>3.2.3.RELEASE</version>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>3.2.3.RELEASE</version>
        </dependency>


        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>3.2.3.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.osgi</groupId>
            <artifactId>spring-osgi-io</artifactId>
            <version>1.2.1</version>
        </dependency>

    </dependencies>
</project>

我的 pom.xml 文件中是否缺少任何内容。我正在使用 Eclipse Juno

下面是我的项目的图片-

enter image description here

最佳答案

将 org.osgi:org.osgi.core 及其提供的范围放入您的 pom.xml 中。从这里选择一个版本 http://search.maven.org/#search|gav|1|g%3A%22org.osgi%22%20AND%20a%3A%22org.osgi.core%22 .

关于java - 使用 Spring OSGi 时,BundleActivator 无法解析为类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18220830/

相关文章:

java - Google Cloud Datastore - Java - GQLQuery 游标

Java,存储Timezone对象

java - OSGi:加载与子类不同版本的父类(super class)静态连接到

java - OSGi:Java 8 上缺少包 javax.security.auth

java - 更新依赖于其他实体状态的@Entity 字段的正确方法

java-native-interface - 从 JNI 加载 OSGi 类

java - 防止内部事务回滚外部事务

java - 多个字段 : volatile or AtomicReference?

Java Spring Mongo 排序忽略大小写问题

javascript - 是否有相当于 Spring :bind for binding forms and data on the front end?