java.lang.LinkageError: loader constraint violation: when resolving interface method

#1

Seems that something is not matching.

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.0.Final</version>
</dependency>

<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<version>5.11.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-mapper-orm</artifactId>
<version>6.0.0.Alpha1</version>
</dependency>
<dependency>
<groupId>org.hibernate.search</groupId>
<artifactId>hibernate-search-backend-elasticsearch</artifactId>
<version>6.0.0.Alpha1</version>
</dependency>

12:48:11,634 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.unit."-1.142.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."-1.142.war".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1730)
at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1558)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jboss.weld.exceptions.DeploymentException
at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:38)
at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:499)
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:98)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1738)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1700)
… 6 more
Caused by: javax.enterprise.event.ObserverException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at java.lang.Class.newInstance(Class.java:442)
at org.jboss.weld.security.NewInstanceAction.run(NewInstanceAction.java:33)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:40)
at org.jboss.weld.injection.Exceptions.rethrowException(Exceptions.java:78)
at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:103)
at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:144)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
at javax.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:124)
at org.jboss.weld.util.Observers.notify(Observers.java:166)
at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171)
at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)
… 12 more
Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method “org.hibernate.boot.spi.MetadataBuildingOptions.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;” the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/hibernate/search/mapper/orm/model/impl/HibernateOrmBootstrapIntrospector, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method’s defining class, org/hibernate/boot/spi/MetadataBuildingOptions, have different Class objects for the type org/hibernate/annotations/common/reflection/ReflectionManager used in the signature
at org.hibernate.search.mapper.orm.model.impl.HibernateOrmBootstrapIntrospector.(HibernateOrmBootstrapIntrospector.java:75)
at org.hibernate.search.mapper.orm.mapping.impl.HibernateOrmMappingInitiator.create(HibernateOrmMappingInitiator.java:50)
at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchSessionFactoryObserver.boot(HibernateSearchSessionFactoryObserver.java:134)
at org.hibernate.search.mapper.orm.bootstrap.impl.HibernateSearchSessionFactoryObserver.lambda$sessionFactoryCreated$2(HibernateSearchSessionFactoryObserver.java:98)
at org.hibernate.search.mapper.orm.bootstrap.impl.ExtendedBeanManagerSynchronizer.beanManagerInitialized(ExtendedBeanManagerSynchronizer.java:38)
at org.jboss.as.jpa.hibernate5.HibernateExtendedBeanManager.beanManagerIsAvailableForUse(HibernateExtendedBeanManager.java:69)
at org.jboss.as.jpa.hibernate5.HibernatePersistenceProviderAdaptor.markPersistenceUnitAvailable(HibernatePersistenceProviderAdaptor.java:183)
at org.jboss.as.jpa.beanmanager.BeanManagerAfterDeploymentValidation$DeferredCall.markPersistenceUnitAvailable(BeanManagerAfterDeploymentValidation.java:83)
at org.jboss.as.jpa.beanmanager.BeanManagerAfterDeploymentValidation.markPersistenceUnitAvailable(BeanManagerAfterDeploymentValidation.java:68)
at org.jboss.as.jpa.beanmanager.BeanManagerAfterDeploymentValidation.afterDeploymentValidation(BeanManagerAfterDeploymentValidation.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
… 25 more

12:48:11,654 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation (“deploy”) failed - address: ([(“deployment” => “-1.142”)]) - failure description: {“WFLYCTL0080: Failed services” => {“jboss.deployment.unit.”-1.142.war".WeldStartService" => “Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException
Caused by: javax.enterprise.event.ObserverException
Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method “org.hibernate.boot.spi.MetadataBuildingOptions.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;” the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/hibernate/search/mapper/orm/model/impl/HibernateOrmBootstrapIntrospector, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method’s defining class, org/hibernate/boot/spi/MetadataBuildingOptions, have different Class objects for the type org/hibernate/annotations/common/reflection/ReflectionManager used in the signature”}}
12:48:11,656 ERROR [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0021: Deploy of deployment “1.142.war” was rolled back with the following failure message:
{“WFLYCTL0080: Failed services” => {“jboss.deployment.unit.“1.142.war”.WeldStartService” => “Failed to start service
Caused by: org.jboss.weld.exceptions.DeploymentException
Caused by: javax.enterprise.event.ObserverException
Caused by: java.lang.LinkageError: loader constraint violation: when resolving interface method “org.hibernate.boot.spi.MetadataBuildingOptions.getReflectionManager()Lorg/hibernate/annotations/common/reflection/ReflectionManager;” the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, org/hibernate/search/mapper/orm/model/impl/HibernateOrmBootstrapIntrospector, and the class loader (instance of org/jboss/modules/ModuleClassLoader) for the method’s defining class, org/hibernate/boot/spi/MetadataBuildingOptions, have different Class objects for the type org/hibernate/annotations/common/reflection/ReflectionManager used in the signature”}}

0 Likes

#2

First, be aware that Hibernate Search 6 has not been tested on WildFly yet, which is why we do not provide WildFly modules.

Hibernate Search 6.0.0.Alpha1 is an Alpha, and as such has several limitations. Read more on our blog.

WildFly modules (and consequently, proper testing for WildFly) will be added later, likely in 6.1, because Search 6 is such a major overhaul.

Regarding your specific problem, it seems to be related to the fact you bundled Hibernate Search with your application, and probably Hibernate ORM too. I’m not sure how you can use your own copy of Hibernate ORM JARs in WildFly.

But I know that you have to set wildfly.jpa.hibernate.search.module to none in your persistence.xml in order to prevent WildFly from adding its own copy of Hibernate Search…

If you really want to test Hibernate Search in WildFly, you will need the following:

  1. Set wildfly.jpa.hibernate.search.module to none in your persistence.xml, to prevent WildFly from adding Hibernate Search 5 to the classpath
  2. Try to force the use of the version of Hibernate ORM bundled with WildFly somehow. Maybe you could just not bundle Hibernate ORM with your application? I don’t know how you bundle your application, so I can’t really help there.

Then you might be able to make it work… but I’m really not sure.

0 Likes

#3

Thank you for your help. Do you know when this version will be in Beta?

0 Likes

#4

I can show you what’s left to do: https://hibernate.atlassian.net/issues/?jql=statusCategory%20%3D%20new%20AND%20project%20%3D%2010061%20AND%20fixVersion%20%3D%2031710%20ORDER%20BY%20priority%20DESC%2C%20key%20ASC . Once everything on that list is done, we will be able to release a beta. There is a lot of exploration work, though, so I can’t really give you a timeline.

EDIT: replaced the link with another link that can be accessed without logging into our JIRA

0 Likes