java ee - ClassLoading issue in Jboss Wildfly -
i'm trying create application java ee , jboss wildfly. i've integrated spring security handle authentication , i'm using custom user detail service lookup user details in database.
i have eao written in ejb module , being accessed userdeailservice in web module.
but when login following error shown.
java.lang.linkageerror: loader constraint violation: when resolving interface method "com.company.eao.usereao.findbyusername(ljava/lang/string;)lorg/springframework/security/core/userdetails/userdetails;" class loader (instance of org/jboss/modules/moduleclassloader) of current class, com/company/security/userdetailservicewrapper, , class loader (instance of org/jboss/modules/moduleclassloader) method's defining class, com/company/eao/usereao, have different class objects type org/springframework/security/core/userdetails/userdetails used in signature
from articles read seem both ejb module class loader , web module class loader loads userdetail class hens error occurred.
how can specify use 1 class loader in wildfly or else how fix issue.
thanks in advance.
you need make sure 1 version of library used both deployments since these deployments interchange objects classes part of lib. deploying lib server or creating wildfly module lib. in both cases both of deployments must declare dependency lib , should fine.
the solution mentioned above should work prefer use jdk-classes or classes of custom library created own data interchange classes. way reduce dependencies of deployments , won't come trouble introducing newer versions of libraries, ... furthermore, package lib war/ear , pass-around custom data object without problems.
Comments
Post a Comment