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);
}
}
コードはコンパイルされません。 'Activate'アノテーションのインポートが欠落しているようです。 – toniedzwiedz
@Krishクラスには 'import org.apache.felix.scr.annotations.Activate;'がありますか? – VAr
@VAr&toniedzwiedzは、ポインタのインポートのおかげで逃した。それは私のコンパイルの問題をかき消してしまった。 – krish