The module that I am deploying in jboss has a dependency with org.springframework:spring-orm:4.3.16.Release. I don't see any duplicate dependency added into the classpath. Based on the exception what I understood is that my application compiles successfully with one version and during deployment it is referring another version. But I don't see any duplicate versions anywhere.
Can Anyone please help me with a solution here? Please find the detailed exception below.
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."ROOT.war".undertow-deployment" => "java.lang.RuntimeException: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(Ljavax/persistence/spi/PersistenceUnitInfo;Ljava/util/Map;)Ljavax/persistence/EntityManagerFactory;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider, and its superclass loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type javax/persistence/EntityManagerFactory used in the signature Caused by: java.lang.RuntimeException: [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(Ljavax/persistence/spi/PersistenceUnitInfo;Ljava/util/Map;)Ljavax/persistence/EntityManagerFactory;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider, and its superclass loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type javax/persistence/EntityManagerFactory used in the signature Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(Ljavax/persistence/spi/PersistenceUnitInfo;Ljava/util/Map;)Ljavax/persistence/EntityManagerFactory;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider, and its superclass loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type javax/persistence/EntityManagerFactory used in the signature Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(Ljavax/persistence/spi/PersistenceUnitInfo;Ljava/util/Map;)Ljavax/persistence/EntityManagerFactory;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider, and its superclass loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type javax/persistence/EntityManagerFactory used in the signature Caused by: java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(Ljavax/persistence/spi/PersistenceUnitInfo;Ljava/util/Map;)Ljavax/persistence/EntityManagerFactory;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/springframework/orm/jpa/vendor/SpringHibernateJpaPersistenceProvider, and its superclass loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type javax/persistence/EntityManagerFactory used in the signature"}}
java.lang.LinkageErroroccurs when a class is loaded by more than one classloader and those classes are used together in the same code.In your situation, check if your application is packaging any jars that contain JDK or J2EE API classes and remove them.