我的项目结构就像三个包,分别是Rest(在其中放置Rest API及其实现类),Service API(在其中定义服务接口)和Service Impl(在其中放置Service API的实现)。我的代码PersonalInfoServiceImpl
只是将PersonalInfoRequestBean
值设置为PersonalInfoResponseBean
(+更多属性)对象并返回PersonalInfoResponseBean
。工作正常。但是在与更多的拦截器集成之后,现在突然我开始在此代码中收到以下错误:
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依赖关系相关,那么调试此问题的方法是什么。
此错误消息表示您有2个personal/info/model/PersonalInfoRequestBean
具有不同类加载器的已加载类。其中的一个classloader加载接口PersonalInfoService
和其他加载实现PersonalInfoRESTServiceImpl
。您应该避免这种情况,并且您的类personal/info/model/PersonalInfoRequestBean
只能由加载接口的类加载器定义。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句