Cluster Wildfly throws java.lang.IllegalAccessError

I am running an application on a Wildfly managed domain that consists of 2 virtual machines with 3 servers on each virtual machine.

An exception occurs in console.log:

14:04:10,254 WARN  [org.jboss.weld.Servlet] (default task-51) WELD-000717: Unable to deactivate context org.jboss.weld.context.http.HttpRequestContextImpl@2ec2ea52 when destroying request HttpServletRequestImpl [ GET /orpon/ ]
14:04:10,254 WARN  [org.jboss.weld.Servlet] (default task-51) WELD-000717: Unable to deactivate context org.jboss.weld.context.http.HttpSessionContextImpl@f171e22 when destroying request HttpServletRequestImpl [ GET /orpon/ ]
14:04:10,254 ERROR [io.undertow.request] (default task-51) Undertow request failed HttpServerExchange{ GET /orpon/}: java.lang.IllegalAccessError: Can not set final int field io.undertow.util.HttpString.hashCode to (int)-1978065285
    at io.undertow.util.HttpString.readObject(HttpString.java:340)
    at sun.reflect.GeneratedMethodAccessor167.invoke(Unknown Source) [:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_66]
    at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:307)
    at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1644)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
    at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:149)
    at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:135)
    at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:53)
    at org.jboss.marshalling.river.RiverObjectInputStream.readObjectOverride(RiverObjectInputStream.java:307)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:365) [rt.jar:1.8.0_66]
    at java.util.HashMap.readObject(HashMap.java:1394) [rt.jar:1.8.0_66]
    at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source) [:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_66]
    at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:307)
    at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1637)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:224)
    at org.jboss.marshalling.river.RiverUnmarshaller.readFields(RiverUnmarshaller.java:1745)
    at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1658)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
    at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:149)
    at org.jboss.marshalling.river.BlockUnmarshaller.readObject(BlockUnmarshaller.java:135)
    at org.jboss.marshalling.MarshallerObjectInputStream.readObjectOverride(MarshallerObjectInputStream.java:53)
    at org.jboss.marshalling.river.RiverObjectInputStream.readObjectOverride(RiverObjectInputStream.java:307)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:365) [rt.jar:1.8.0_66]
    at java.util.HashMap.readObject(HashMap.java:1396) [rt.jar:1.8.0_66]
    at sun.reflect.GeneratedMethodAccessor157.invoke(Unknown Source) [:1.8.0_66]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_66]
    at java.lang.reflect.Method.invoke(Method.java:497) [rt.jar:1.8.0_66]
    at org.jboss.marshalling.reflect.SerializableClass.callReadObject(SerializableClass.java:307)
    at org.jboss.marshalling.river.RiverUnmarshaller.doInitSerializable(RiverUnmarshaller.java:1637)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1285)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:276)
    at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:209)
    at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41)
    at org.wildfly.clustering.marshalling.SimpleMarshalledValue.get(SimpleMarshalledValue.java:101)
    at org.wildfly.clustering.marshalling.SimpleMarshalledValue.get(SimpleMarshalledValue.java:45)
    at org.wildfly.clustering.marshalling.MarshalledValueMarshaller.read(MarshalledValueMarshaller.java:45)
    at org.wildfly.clustering.marshalling.MarshalledValueMarshaller.read(MarshalledValueMarshaller.java:32)
    at org.wildfly.clustering.web.infinispan.session.coarse.CoarseSessionFactory.findValue(CoarseSessionFactory.java:127)
    at org.wildfly.clustering.web.infinispan.session.coarse.CoarseSessionFactory.findValue(CoarseSessionFactory.java:56)
    at org.wildfly.clustering.web.infinispan.session.InfinispanSessionManager.findSession(InfinispanSessionManager.java:232)
    at org.wildfly.clustering.web.undertow.session.DistributableSessionManager.getSession(DistributableSessionManager.java:115)
    at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:723)
    at io.undertow.servlet.spec.ServletContextImpl.getSession(ServletContextImpl.java:753)
    at io.undertow.servlet.spec.ServletContextImpl.updateSessionAccessTime(ServletContextImpl.java:757)
    at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:548)
    at io.undertow.servlet.spec.HttpServletResponseImpl.doErrorDispatch(HttpServletResponseImpl.java:162)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:317)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_66]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_66]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_66]

I am trying to run an application on wildfly 8.2.1.Final and 9.0.2 Final with openjdk-1.8 and Oracle jdk-1.8 with the same result. The application is deployed and works without errors, I successfully log into the system and work on servers through a load balancer (round robin).

In the source stream in github, the hashCodeclass field is io.undertow.util.HttpStringdeclared as final transient int. Why is the method readObjecttrying to change the value of this field in a very strange way?

I googled on the Internet, but did not find anything about this or similar error and do not know what to do with it.

, ?

: Undertow server :

From 7083c4145878f954bbde14f1f6acbb31414c88d9 Mon Sep 17 00:00:00 2001
From: fedor patlin <patlin.f@sovzond.center>
Date: Fri, 18 Dec 2015 15:55:32 +0500
Subject: [PATCH] Set field hashCodeField accessible

---
 core/src/main/java/io/undertow/util/HttpString.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/core/src/main/java/io/undertow/util/HttpString.java b/core/src/main/java/io/undertow/util/HttpString.java
index cc75a0b..d21257c 100644
--- a/core/src/main/java/io/undertow/util/HttpString.java
+++ b/core/src/main/java/io/undertow/util/HttpString.java
@@ -335,7 +335,9 @@ public final class HttpString implements Comparable<HttpString>, Serializable {
     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
         ois.defaultReadObject();
         try {
+            hashCodeField.setAccessible(true);
             hashCodeField.setInt(this, calcHashCode(bytes));
+            hashCodeField.setAccessible(false);
         } catch (IllegalAccessException e) {
             throw new IllegalAccessError(e.getMessage());
         }
-- 
2.5.0
+4
1

Wildfly, . fix.

+2

Source: https://habr.com/ru/post/1620253/


All Articles