간단한 OSGi 번들이 작성되었으며 여기에 소스 파일이 있습니다. 춘분 OSGi 컨테이너에 설치하면 자동으로 해결되지 않습니다. 누군가 내가 여기서 잘못하고있는 것을 설명 할 수 있습니까?OSGi 번들이 자동으로 해결되지 않음
package org.sample.api;
/**
* Created on 3/11/14.
*/
public interface Hello {
void sayHello();
}
이것은 번들의 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>
<artifactId>osgi</artifactId>
<groupId>osgi</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>sample-api</artifactId>
<version>1.0</version>
<packaging>bundle</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Vendor>Sample Inc</Bundle-Vendor>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Export-Package>
org.sample.api*;version=1.0.0
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
MANIFEST.MF는
Manifest-Version: 1
Bnd-LastModified: 1396602001251
Build-Jdk: 1.6.0_45
Built-By: Zeus
Bundle-ManifestVersion: 2
Bundle-Name: sample-api
Bundle-SymbolicName: sample-api
Bundle-Vendor: Sample Inc
Bundle-Version: 1.0.0
Created-By: Apache Maven Bundle Plugin
Export-Package: org.sample.api;version="1.0.0"
Tool: Bnd-1.43.0
이 번들 설치 콘솔 출력
Bundle id is 7
RegisteredServices null
ServicesInUse null
LoaderProxy sample-api; bundle-version="1.0.0"
Fragments null
ClassLoader null
Version 1.0.0
LastModified 1396605985751
Headers Bnd-LastModified = 1396602001251
Build-Jdk = 1.6.0_45
Built-By = Zeus
Bundle-ManifestVersion = 2
Bundle-Name = sample-api
Bundle-SymbolicName = sample-api
Bundle-Vendor = Sample Inc
Bundle-Version = 1.0.0
Created-By = Apache Maven Bundle Plugin
Export-Package = org.sample.api;version="1.0.0"
Manifest-Version = 1
Tool = Bnd-1.43.0
BundleContext null
BundleId 7
StartLevel 1
SymbolicName sample-api
BundleData sample-api_1.0.0
KeyHashCode 7
StateChanging null
BundleDescription sample-api_1.0.0
Framework [email protected]
ResolutionFailureException org.osgi.framework.BundleException: The bundle "sample-api_1.0.0 [7]" could not be resolved
Revisions [sample-api_1.0.0]
Key 7
ProtectionDomain null
Location file:/home/Zeus/idea-projects/osgi/sample-api/target/sample-api-1.0.jar
State 2
Bundle 7|Installed | 1|sample-api (1.0.0)
매니페스트 데이터를 추가했습니다. INSTALLED 상태입니다. "diag"명령을 사용할 때 아무런 해결되지 않은 제약 조건이 없다고 말합니다. –
반드시 필요한 것은 아니지만 문제를 해결하려면 Bundle-Activator를 추가하고 시작이 호출되는지 확인하십시오. – Anshuman
내 컴퓨터에서 예제를 실행하려고했는데 (Karaf, 2.4.0 번들 플러그인을 사용하고 있습니다) 제대로 작동합니다. 활성 | 80 | 1.0.0 | sample-api – Anshuman