Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-26952

LinkageError: loader constraint violation for class io.netty.*

XMLWordPrintable

    • False
    • None
    • False
    • Workaround Exists
    • Hide

      I was able to overcome that problem by changing war infinispan-client-hotrod dependency from compile scope to provided scope and adding app dependency on module org.infinispan.client.hotrod into jboss-deployment-structure.xml.

      But note, customers who does not have access to app sources (we know such exists) will be not able to apply such workaround.

      Show
      I was able to overcome that problem by changing war infinispan-client-hotrod dependency from compile scope to provided scope and adding app dependency on module org.infinispan.client.hotrod into jboss-deployment-structure.xml. But note, customers who does not have access to app sources (we know such exists) will be not able to apply such workaround.
    • Hide
      uznip hotrod_query.zip
      mvn package
      cp ROOT.war <xp5_server>/standalone/deployments
      standalone.sh -c standalone-microprofile.xml
      curl http://127.0.0.1:8080/hotrod?operation=read&cache=respCache&key=mykey
      # exception emitted in server log
      # trying same on EAP8 exception does not occur, but fail on timeout on nonexisting datagrid
      
      Show
      uznip hotrod_query.zip mvn package cp ROOT.war <xp5_server>/standalone/deployments standalone.sh -c standalone-microprofile.xml curl http: //127.0.0.1:8080/hotrod?operation=read&cache=respCache&key=mykey # exception emitted in server log # trying same on EAP8 exception does not occur, but fail on timeout on nonexisting datagrid

      With XP5 we are encountering failure of hotrod connection to datagrid server. With EAP8 same scenario works ok.

      Use case is specific hotrod client jars are bundled into war directly.

      07:04:06,318 WARN  [io.netty.channel.ChannelInitializer] (HotRod-client-async-pool-1-12) Failed to initialize a channel. Closing: [id: 0x2ae7b5cc]: java.lang.LinkageError: loader constraint violation for class org.infinispan.client.hotrod.impl.transport.netty.HintingByteBuf: when selecting overriding method 'io.netty.util.ReferenceCounted org.infinispan.client.hotrod.impl.transport.netty.HintingByteBuf.touch(java.lang.Object)' the class loader 'deployment.ROOT.war' @2c4e220c of the selected method's type org.infinispan.client.hotrod.impl.transport.netty.HintingByteBuf, and the class loader 'io.netty.netty-buffer@4.1.100.Final-redhat-00001' @e9ab2ad for its super type io.netty.buffer.ByteBuf have different Class objects for the type io.netty.util.ReferenceCounted used in the signature (org.infinispan.client.hotrod.impl.transport.netty.HintingByteBuf is in unnamed module of loader 'deployment.ROOT.war' @2c4e220c, parent loader 'app'; io.netty.buffer.ByteBuf is in unnamed module of loader 'io.netty.netty-buffer@4.1.100.Final-redhat-00001' @e9ab2ad, parent loader 'app')
      	at deployment.ROOT.war//org.infinispan.client.hotrod.impl.transport.netty.HintedReplayingDecoder.<init>(HintedReplayingDecoder.java:23)
      	at deployment.ROOT.war//org.infinispan.client.hotrod.impl.transport.netty.HeaderDecoder.<init>(HeaderDecoder.java:54)
      	at deployment.ROOT.war//org.infinispan.client.hotrod.impl.transport.netty.ChannelInitializer.initChannel(ChannelInitializer.java:120)
      	at deployment.ROOT.war//io.netty.channel.ChannelInitializer.initChannel(ChannelInitializer.java:129)
      	at deployment.ROOT.war//io.netty.channel.ChannelInitializer.handlerAdded(ChannelInitializer.java:112)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannelHandlerContext.callHandlerAdded(AbstractChannelHandlerContext.java:1114)
      	at deployment.ROOT.war//io.netty.channel.DefaultChannelPipeline.callHandlerAdded0(DefaultChannelPipeline.java:609)
      	at deployment.ROOT.war//io.netty.channel.DefaultChannelPipeline.access$100(DefaultChannelPipeline.java:46)
      	at deployment.ROOT.war//io.netty.channel.DefaultChannelPipeline$PendingHandlerAddedTask.execute(DefaultChannelPipeline.java:1463)
      	at deployment.ROOT.war//io.netty.channel.DefaultChannelPipeline.callHandlerAddedForAllHandlers(DefaultChannelPipeline.java:1115)
      	at deployment.ROOT.war//io.netty.channel.DefaultChannelPipeline.invokeHandlerAddedIfNeeded(DefaultChannelPipeline.java:650)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:514)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:429)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:486)
      	at deployment.ROOT.war//io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
      	at deployment.ROOT.war//io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
      	at deployment.ROOT.war//io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
      	at deployment.ROOT.war//io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:416)
      	at deployment.ROOT.war//io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
      	at deployment.ROOT.war//io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      	at java.base/java.lang.Thread.run(Thread.java:840)
      
      07:04:06,321 ERROR [org.infinispan.HOTROD] (HotRod-client-async-pool-1-12) ISPN004007: Exception encountered. Retry 10 out of 10: io.netty.resolver.dns.DnsResolveContext$SearchDomainUnknownHostException: Failed to resolve 'jdg-cache-htrd' [A(1)] and search domain query for configured domains failed as well: [mchoma2.svc.cluster.local, svc.cluster.local, cluster.local, eapqe-034-nvf2.eapqe.psi.redhat.com]
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.finishResolve(DnsResolveContext.java:1097)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.tryToFinishResolve(DnsResolveContext.java:1044)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:432)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.access$700(DnsResolveContext.java:66)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext$2.operationComplete(DnsResolveContext.java:500)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:557)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:185)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.addListener(DefaultPromise.java:35)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:463)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:1163)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.internalResolve(DnsResolveContext.java:372)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.doSearchDomainQuery(DnsResolveContext.java:298)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsAddressResolveContext.doSearchDomainQuery(DnsAddressResolveContext.java:98)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.resolve(DnsResolveContext.java:261)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.resolveNow(DnsNameResolver.java:1227)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.doResolveAllUncached0(DnsNameResolver.java:1213)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.doResolveAllUncached(DnsNameResolver.java:1155)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.doResolveAll(DnsNameResolver.java:1104)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.doResolveAll(DnsNameResolver.java:1072)
      	at deployment.ROOT.war//io.netty.resolver.SimpleNameResolver.resolveAll(SimpleNameResolver.java:79)
      	at deployment.ROOT.war//io.netty.resolver.dns.InflightNameResolver.resolve(InflightNameResolver.java:96)
      	at deployment.ROOT.war//io.netty.resolver.dns.InflightNameResolver.resolveAll(InflightNameResolver.java:71)
      	at deployment.ROOT.war//io.netty.resolver.dns.InflightNameResolver.resolveAll(InflightNameResolver.java:56)
      	at deployment.ROOT.war//io.netty.resolver.RoundRobinInetAddressResolver.doResolve(RoundRobinInetAddressResolver.java:55)
      	at deployment.ROOT.war//io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:61)
      	at deployment.ROOT.war//io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:53)
      	at deployment.ROOT.war//io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:55)
      	at deployment.ROOT.war//io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:31)
      	at deployment.ROOT.war//io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:106)
      	at deployment.ROOT.war//io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:220)
      	at deployment.ROOT.war//io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:46)
      	at deployment.ROOT.war//io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:189)
      	at deployment.ROOT.war//io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:175)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:557)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:105)
      	at deployment.ROOT.war//io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:990)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:516)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:429)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:486)
      	at deployment.ROOT.war//io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
      	at deployment.ROOT.war//io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
      	at deployment.ROOT.war//io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
      	at deployment.ROOT.war//io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:416)
      	at deployment.ROOT.war//io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
      	at deployment.ROOT.war//io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      	at java.base/java.lang.Thread.run(Thread.java:840)
      Caused by: io.netty.resolver.dns.DnsNameResolverException: [3744: /172.122.0.10:53] DefaultDnsQuestion(jdg-cache-htrd.mchoma2.svc.cluster.local. IN A) failed to send a query '3744' via UDP (no stack trace available)
      Caused by: io.netty.handler.codec.EncoderException: java.lang.LinkageError: loader constraint violation in interface itable initialization for class io.netty.channel.socket.DatagramPacket: when selecting method 'io.netty.util.ReferenceCounted io.netty.util.ReferenceCounted.touch(java.lang.Object)' the class loader 'io.netty.netty-common@4.1.100.Final-redhat-00001' @2dce5ec6 for super interface io.netty.util.ReferenceCounted, and the class loader 'deployment.ROOT.war' @2c4e220c of the selected method's class, io.netty.channel.socket.DatagramPacket have different Class objects for the type io.netty.util.ReferenceCounted used in the signature (io.netty.util.ReferenceCounted is in unnamed module of loader 'io.netty.netty-common@4.1.100.Final-redhat-00001' @2dce5ec6, parent loader 'app'; io.netty.channel.socket.DatagramPacket is in unnamed module of loader 'deployment.ROOT.war' @2c4e220c, parent loader 'app')
      	at deployment.ROOT.war//io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:107)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:881)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:863)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:968)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:856)
      	at deployment.ROOT.war//io.netty.channel.DefaultChannelPipeline.write(DefaultChannelPipeline.java:1015)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel.write(AbstractChannel.java:301)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsQueryContext.writeQuery(DnsQueryContext.java:260)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsQueryContext.sendQuery(DnsQueryContext.java:221)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsQueryContext.writeQuery(DnsQueryContext.java:208)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.query0(DnsNameResolver.java:1345)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:459)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.query(DnsResolveContext.java:1163)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.internalResolve(DnsResolveContext.java:372)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.doSearchDomainQuery(DnsResolveContext.java:298)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsAddressResolveContext.doSearchDomainQuery(DnsAddressResolveContext.java:98)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsResolveContext.resolve(DnsResolveContext.java:261)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.resolveNow(DnsNameResolver.java:1227)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.doResolveAllUncached0(DnsNameResolver.java:1213)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.doResolveAllUncached(DnsNameResolver.java:1155)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.doResolveAll(DnsNameResolver.java:1104)
      	at deployment.ROOT.war//io.netty.resolver.dns.DnsNameResolver.doResolveAll(DnsNameResolver.java:1072)
      	at deployment.ROOT.war//io.netty.resolver.SimpleNameResolver.resolveAll(SimpleNameResolver.java:79)
      	at deployment.ROOT.war//io.netty.resolver.dns.InflightNameResolver.resolve(InflightNameResolver.java:96)
      	at deployment.ROOT.war//io.netty.resolver.dns.InflightNameResolver.resolveAll(InflightNameResolver.java:71)
      	at deployment.ROOT.war//io.netty.resolver.dns.InflightNameResolver.resolveAll(InflightNameResolver.java:56)
      	at deployment.ROOT.war//io.netty.resolver.RoundRobinInetAddressResolver.doResolve(RoundRobinInetAddressResolver.java:55)
      	at deployment.ROOT.war//io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:61)
      	at deployment.ROOT.war//io.netty.resolver.SimpleNameResolver.resolve(SimpleNameResolver.java:53)
      	at deployment.ROOT.war//io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:55)
      	at deployment.ROOT.war//io.netty.resolver.InetSocketAddressResolver.doResolve(InetSocketAddressResolver.java:31)
      	at deployment.ROOT.war//io.netty.resolver.AbstractAddressResolver.resolve(AbstractAddressResolver.java:106)
      	at deployment.ROOT.war//io.netty.bootstrap.Bootstrap.doResolveAndConnect0(Bootstrap.java:220)
      	at deployment.ROOT.war//io.netty.bootstrap.Bootstrap.access$000(Bootstrap.java:46)
      	at deployment.ROOT.war//io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:189)
      	at deployment.ROOT.war//io.netty.bootstrap.Bootstrap$1.operationComplete(Bootstrap.java:175)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListener0(DefaultPromise.java:590)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListenersNow(DefaultPromise.java:557)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.notifyListeners(DefaultPromise.java:492)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.setValue0(DefaultPromise.java:636)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.setSuccess0(DefaultPromise.java:625)
      	at deployment.ROOT.war//io.netty.util.concurrent.DefaultPromise.trySuccess(DefaultPromise.java:105)
      	at deployment.ROOT.war//io.netty.channel.DefaultChannelPromise.trySuccess(DefaultChannelPromise.java:84)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe.safeSetSuccess(AbstractChannel.java:990)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe.register0(AbstractChannel.java:516)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe.access$200(AbstractChannel.java:429)
      	at deployment.ROOT.war//io.netty.channel.AbstractChannel$AbstractUnsafe$1.run(AbstractChannel.java:486)
      	at deployment.ROOT.war//io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173)
      	at deployment.ROOT.war//io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166)
      	at deployment.ROOT.war//io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470)
      	at deployment.ROOT.war//io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:416)
      	at deployment.ROOT.war//io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
      	at deployment.ROOT.war//io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      	at java.base/java.lang.Thread.run(Thread.java:840)
      Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization for class io.netty.channel.socket.DatagramPacket: when selecting method 'io.netty.util.ReferenceCounted io.netty.util.ReferenceCounted.touch(java.lang.Object)' the class loader 'io.netty.netty-common@4.1.100.Final-redhat-00001' @2dce5ec6 for super interface io.netty.util.ReferenceCounted, and the class loader 'deployment.ROOT.war' @2c4e220c of the selected method's class, io.netty.channel.socket.DatagramPacket have different Class objects for the type io.netty.util.ReferenceCounted used in the signature (io.netty.util.ReferenceCounted is in unnamed module of loader 'io.netty.netty-common@4.1.100.Final-redhat-00001' @2dce5ec6, parent loader 'app'; io.netty.channel.socket.DatagramPacket is in unnamed module of loader 'deployment.ROOT.war' @2c4e220c, parent loader 'app')
      	at deployment.ROOT.war//io.netty.handler.codec.dns.DatagramDnsQueryEncoder.encode(DatagramDnsQueryEncoder.java:72)
      	at deployment.ROOT.war//io.netty.handler.codec.dns.DatagramDnsQueryEncoder.encode(DatagramDnsQueryEncoder.java:33)
      	at deployment.ROOT.war//io.netty.handler.codec.MessageToMessageEncoder.write(MessageToMessageEncoder.java:90)
      	... 55 more
      

      I was able to overcome that problem by changing war infinispan-client-hotrod dependency from compile scope to provided scope and adding app dependency on module org.infinispan.client.hotrod into jboss-deployment-structure.xml.

      But main question still stand, why such change is necessary now with XP5, while it works ok with 8.0.0.GA? There are some customers who do not have access to sources and could not do similar app changes that would be blocker for them to migrate.

        1. hotrod_client_packaged_in_war.log
          5.17 MB
          Martin Choma
        2. hotrod_client_provided_from_server.log
          2.61 MB
          Martin Choma

              jaslee@redhat.com Jason Lee
              mchoma@redhat.com Martin Choma
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: