2017-11-04 20 views
0

OSGI 번들을 생성하고 싶다. 나는 간단한 클래스를 createad : 아파치에서 OSGI 번들을 시작할 수 없다 ServiceMix

public class Activator implements BundleActivator { 
public void start(BundleContext bundleContext) throws Exception { 
    System.out.println("::::START MAIL BUNDLE::::"); 
} 

public void stop(BundleContext bundleContext) throws Exception { 
    System.out.println("::::STOP MAIL BUNDLE::::"); 
} 
} 

pom.xml : 나는 Service Mix을 사용

<dependencies> 
    <dependency> 
     <groupId>org.osgi</groupId> 
     <artifactId>org.osgi.core</artifactId> 
     <version>6.0.0</version> 
    </dependency> 
</dependencies> 

<build> 
    <plugins> 
     <plugin> 
      <inherited>true</inherited> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>osgi-bundle</id> 
        <goals> 
         <goal>bundle</goal> 
        </goals> 
        <phase>package</phase> 
        <configuration> 
         <instructions> 
          <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> 
          <Bundle-Version>${project.version}</Bundle-Version> 
          <Import-Package> 
           *;resolution:=optional 
          </Import-Package> 
         </instructions> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

. 대상 폴더에 org.osgi.core-6.0.0.jar과 jar를 추가합니다. 내 번들이 활성화되어 있지만 karaf 콘솔에 번들 시작/중지시 내 메시지가 표시되지 않습니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

답변

1

maven-bundle-config에 <Bundle-Activator>your.package.name.Activator</Bundle-Activator>을 설정해야합니다. org.osgi.core 또는 org.osgi.componendium을 절대로 배포하지 마십시오. 핵심 패키지는 OSGi 프레임 워크와 개개의 스펙에 의해 개괄적으로 배치됩니다.