Recently I encountered the following error while executing Junit test case using Ant. My testcase uses EJBs from a wildfly 24 server. I am using jboss-client.jar file from same server in my testcase.
2021-08-17 16:39:30,450 2428 ERROR [com.tk20.ejb.api.util.EJBUtils] (main:[]) Unable to make private java.lang.reflect.Proxy() accessible: module java.base does not "opens java.lang.reflect" to unnamed module @
394df057
java.lang.reflect.InaccessibleObjectException: Unable to make private java.lang.reflect.Proxy() accessible: module java.base does not "opens java.lang.reflect" to unnamed module @394df057
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[?:?]
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
at java.base/java.lang.reflect.Constructor.checkCanSetAccessible(Constructor.java:188) ~[?:?]
at java.base/java.lang.reflect.Constructor.setAccessible(Constructor.java:181) ~[?:?]
at org.jboss.marshalling.reflect.JDKSpecific$SerMethods.<init>(JDKSpecific.java:147) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.reflect.SerializableClass.<init>(SerializableClass.java:84) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.reflect.SerializableClassRegistry$1.computeValue(SerializableClassRegistry.java:62) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.reflect.SerializableClassRegistry$1.computeValue(SerializableClassRegistry.java:59) ~[jboss-client.jar:24.0.0.Final]
at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228) ~[?:?]
at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210) ~[?:?]
at java.base/java.lang.ClassValue.get(ClassValue.java:116) ~[?:?]
at org.jboss.marshalling.reflect.SerializableClassRegistry.lookup(SerializableClassRegistry.java:83) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.reflect.SerializableClass.<init>(SerializableClass.java:76) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.reflect.SerializableClassRegistry$1.computeValue(SerializableClassRegistry.java:62) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.reflect.SerializableClassRegistry$1.computeValue(SerializableClassRegistry.java:59) ~[jboss-client.jar:24.0.0.Final]
at java.base/java.lang.ClassValue.getFromHashMap(ClassValue.java:228) ~[?:?]
at java.base/java.lang.ClassValue.getFromBackup(ClassValue.java:210) ~[?:?]
at java.base/java.lang.ClassValue.get(ClassValue.java:116) ~[?:?]
at org.jboss.marshalling.reflect.SerializableClassRegistry.lookup(SerializableClassRegistry.java:83) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.river.RiverUnmarshaller.doReadNewObject(RiverUnmarshaller.java:1394) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:298) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.river.RiverUnmarshaller.doReadObject(RiverUnmarshaller.java:231) ~[jboss-client.jar:24.0.0.Final]
at org.jboss.marshalling.AbstractObjectInput.readObject(AbstractObjectInput.java:41) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.remote.RemoteClientTransport.lookup(RemoteClientTransport.java:271) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.remote.RemoteContext.lambda$lookupNative$0(RemoteContext.java:190) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.NamingProvider.performExceptionAction(NamingProvider.java:222) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.remote.RemoteContext.performWithRetry(RemoteContext.java:100) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.remote.RemoteContext.lookupNative(RemoteContext.java:188) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:74) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.store.RelativeFederatingContext.lookupNative(RelativeFederatingContext.java:58) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:74) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:60) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:66) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:66) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.AbstractFederatingContext.lookup(AbstractFederatingContext.java:66) ~[jboss-client.jar:24.0.0.Final]
at org.wildfly.naming.client.WildFlyRootContext.lookup(WildFlyRootContext.java:144) ~[jboss-client.jar:24.0.0.Final]
The reason of failure was traced to version of Ant which I was using version 1.9.15 of Ant. After upgrading Ant to version 1.10.11 the error was removed. Due to some reason with older version of Ant JDKSpecific class which was being used was compatible with JDK8 and not the one which is compatible with JDK9 or higher. After upgrading Ant to 1.10.11 it started picking right version of class and problem was fixed.
Please refer to my earlier post regarding similar error faced while accessing EJB in wildfly 24 without involvement of Ant and JUnit. https://blog.bigdatawithjasvant.com/2021/07/javalangreflectinaccessibleobjectexcept.html
No comments:
Post a Comment