1

私のプロジェクト構造は、Rest (Rest API とその実装クラスが配置される)、Service API (サービス インターフェイスが定義される)、および Service Impl (サービス API の実装が配置される) という 3 つのバンドルがあるようなものです。値を(+いくつかのプロパティ)オブジェクトにPersonalInfoServiceImpl設定して返すだけの私のコード。正常に動作していました。しかし、さらにいくつかのインターセプターと統合した後、突然、このコードで次のエラーが発生し始めました。PersonalInfoRequestBeanPersonalInfoResponseBeanPersonalInfoResponseBean

Caused by java.lang.LinkageError: loader constraint violation: when resolving 
interface method "personal.info.service.api.PersonalInfoService.getPersonalInfoDetails(Lcom//personal/info/model/PersonalInfoRequestBean;)Lpersonal/info/model/PersonalInfoResponseBean;" 
the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) 
of the current class, personal/info/rest/impl/PersonalInfoRESTServiceImpl, 
and the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) 
for the method's defining class, personal/info/service/api/PersonalInfoService, 
have different Class objects for the type personal/info/model/PersonalInfoRequestBean 
used in the signature at personal.info.rest.impl.PersonalInfoRESTServiceImpl.getPersonalInfoDetail(PersonalInfoRESTServiceImpl.java:112)

誰かがこの問題で私を助けることができますか?. サービスのデプロイには Apache karaf を使用しています。したがって、それが karaf/delpoyment/maven の依存関係に関連している場合、この問題をデバッグする方法は何ですか。

4

1 に答える 1

1

このエラー メッセージは、personal/info/model/PersonalInfoRequestBean異なるクラスローダーを持つ 2 つのロード済みクラスがあることを意味します。これらのクラスローダの 1 つはインターフェイスPersonalInfoServiceをロードし、他のクラスローダは実装をロードしますPersonalInfoRESTServiceImpl。これを避ける必要があり、クラスpersonal/info/model/PersonalInfoRequestBeanはインターフェースをロードするクラスローダーによってのみ定義されるべきです。

于 2016-08-12T09:27:22.450 に答える