java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.lang/String;)Lorg/apache/log4j/Logger"

Solution Unverified - Updated -

Issue

  • Getting below error in EAP 6 :
java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.lang/String;)Lorg/apache/log4j/Logger;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/apache/log4j/Logger, and the class loader (instance loader) for resolved class, org/apache/log4j/LogManager, have different Class objects for the type r; used in the signature
  • We are invoking EJB Bean. As the response object, we punt com.example.dto.security.Password into com.example.dto.customer.CommunicationChannel as below:
CommunicationChannel commChannel = new CommunicationChannel();
Password password = new Password();
commChannel.setPasswordData(password);

we got strange exception as follows:

java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name "com/example/dto/security/Password"

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content