2017-03-08 5 views
-1

OSGIクラスを作成しようとしていますが、これはFelixコンソールの設定ダイアログに次のように実装されます。しかし、私がmvn clean install -PautoInstallPackageを実行しようとすると、以下のエラーが発生しています。どんな助けもありがとう。OSGIクラスコンパイルでシンボル@Activateエラーが見つかりません

[ERROR]が目標 org.apache.maven.plugins実行に失敗しました

:mavenの-コンパイラプラグイン:3.2:プロジェクトosgiexample.coreに (デフォルトコンパイル)をコンパイル:コンパイルに失敗

を[ ERROR] /E://osgiexample/core/src/main/java/osgiexample/core/serviceimpl/TestServiceImpl.java:[40,10] シンボル

[ERROR]シンボルを見つけることができません。このクラスは

を有効にします

[ERROR]場所: クラスosgiexample.core.serviceimpl.TestServiceImpl

@Component(immediate=true, label="TEST Service", description="Hello There - This is a Service component", metatype=true) 
@Service(value=TestService.class) 

public class TestServiceImpl implements TestService { 

@Property(value="http://testservice/myservice?wsdl") 
static final String SERVICE_ENDPOINT_URL = "service.endpoint.url"; 

private String serviceEndpointUrl; 

    @Override 
    public String getData() { 
     // TODO Auto-generated method stub 
     return null; 
    } 

    @Activate 
    public void activate(final Map<String, Object> props) { 
    System.out.println("Calling Activate Method"); 
    this.serviceEndpointUrl = (String)props.get(SERVICE_ENDPOINT_URL); 
    System.out.println("ServiceEndpointUrl:" + this.serviceEndpointUrl); 
} 
} 
+0

コードはコンパイルされません。 'Activate'アノテーションのインポートが欠落しているようです。 – toniedzwiedz

+0

@Krishクラスには 'import org.apache.felix.scr.annotations.Activate;'がありますか? – VAr

+0

@VAr&toniedzwiedzは、ポインタのインポートのおかげで逃した。それは私のコンパイルの問題をかき消してしまった。 – krish

答えて

0

あなたの問題

輸入org.apache.felix.scr.annotations.Activateを解決する必要がありますアクティブ注釈import文の下に追加します。

関連する問題