java.lang.IllegalAccessError: tried to access method java.lang.Object.clone()Ljava/lang/Object; from class Test

Coderanch | meeta gaur | 4 years ago
  1. 0

    Cloneable

    Coderanch | 4 years ago | meeta gaur
    java.lang.IllegalAccessError: tried to access method java.lang.Object.clone()Ljava/lang/Object; from class Test
  2. 0

    Why does this Scala code throw IllegalAccessError at runtime?

    Stack Overflow | 5 years ago | Mechanical snail
    java.lang.IllegalAccessError: tried to access field Test$.reflParams$Cache1 from class Test$delayedInit$body
  3. 0

    FULL PRODUCT VERSION : java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+111) Java HotSpot(TM) Client VM (build 9-ea+111, mixed mode) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows [Version 6.1.7601] A DESCRIPTION OF THE PROBLEM : Running an RMI application over webstart now breaks, due to incorrect modularisation. REGRESSION. Last worked in version 8u77 ADDITIONAL REGRESSION INFORMATION: java version "9-ea" Java(TM) SE Runtime Environment (build 9-ea+111) Java HotSpot(TM) Client VM (build 9-ea+111, mixed mode) STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : 1. Set up and export an RMI service at a well-known address (see example code Server.java) 1a) javac Server.java 1b) java -cp . Server 2. Write a small client to connect to it and deploy over webstart with full permissions (see example code Test.java) 2a) javac Test.java 2b) jar mcf allperms-mf test.jar Test.class 2c) jarsigner test.jar signer-alias 3. Launch the provided webstart file EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The client should connect with no error (assuming no firewall, etc., etc) ACTUAL - The client fails to start ERROR MESSAGES/STACK TRACES THAT OCCUR : java.lang.IllegalAccessError: class java.rmi.server.RMIClassLoader (in module java.rmi) cannot access class com.sun.jnlp.JNLPRMIClassLoaderSpi (in module jdk.javaws) because module jdk.javaws does not export com.sun.jnlp to module java.rmi at java.rmi.server.RMIClassLoader.initializeProvider(java.rmi@9-ea/RMIClassLoader.java:689) at java.rmi.server.RMIClassLoader.access$000(java.rmi@9-ea/RMIClassLoader.java:110) at java.rmi.server.RMIClassLoader$1.run(java.rmi@9-ea/RMIClassLoader.java:120) at java.rmi.server.RMIClassLoader$1.run(java.rmi@9-ea/RMIClassLoader.java:119) at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method) at java.rmi.server.RMIClassLoader.<clinit>(java.rmi@9-ea/RMIClassLoader.java:118) at sun.rmi.server.MarshalInputStream.resolveProxyClass(java.rmi@9-ea/MarshalInputStream.java:256) at java.io.ObjectInputStream.readProxyDesc(java.base@9-ea/ObjectInputStream.java:1564) at java.io.ObjectInputStream.readClassDesc(java.base@9-ea/ObjectInputStream.java:1520) at java.io.ObjectInputStream.readOrdinaryObject(java.base@9-ea/ObjectInputStream.java:1779) at java.io.ObjectInputStream.readObject0(java.base@9-ea/ObjectInputStream.java:1356) at java.io.ObjectInputStream.readObject(java.base@9-ea/ObjectInputStream.java:368) at sun.rmi.registry.RegistryImpl_Stub.lookup(java.rmi@9-ea/Unknown Source) at java.rmi.Naming.lookup(java.rmi@9-ea/Naming.java:101) at Test.main(Test.java:5) at sun.reflect.NativeMethodAccessorImpl.invoke0(java.base@9-ea/Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(java.base@9-ea/NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base@9-ea/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@9-ea/Method.java:531) at com.sun.javaws.Launcher.executeApplication(jdk.javaws@9-ea/Launcher.java:1780) at com.sun.javaws.Launcher.executeMainClass(jdk.javaws@9-ea/Launcher.java:1715) at com.sun.javaws.Launcher.doLaunchApp(jdk.javaws@9-ea/Launcher.java:1563) at com.sun.javaws.Launcher.run(jdk.javaws@9-ea/Launcher.java:164) at java.lang.Thread.run(java.base@9-ea/Thread.java:804) REPRODUCIBILITY : This bug can be reproduced always. ---------- BEGIN SOURCE ---------- // Server.java import java.rmi.registry.*; import java.rmi.server.*; public class Server { public static void main(String[] args) throws Exception { Registry r = LocateRegistry.createRegistry(1099); r.bind ("Toto", new UnicastRemoteObject () {}); } } // Test.java import java.rmi.Naming; public class Test { public static void main(String[] args) throws Exception { Naming.lookup("rmi://testmachine:1099/Toto"); } } // test.jnlp ?xml version="1.0" encoding="utf-8"?> <jnlp spec="6.0+" codebase="http://www.example.com/webstart" href="test.jnlp"> <security> <all-permissions/> </security> <resources> <j2se version="1.8+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="64m" max-heap-size="384m" java-vm-args="-ea"/> <jar href="test.jar" main="true"/> </resources> <application-desc main-class="Test"/> </jnlp> ---------- END SOURCE ----------

    JDK Bug System | 10 months ago | Webbug Group
    java.lang.IllegalAccessError: class java.rmi.server.RMIClassLoader (in module java.rmi) cannot access class com.sun.jnlp.JNLPRMIClassLoaderSpi (in module jdk.javaws) because module jdk.javaws does not export com.sun.jnlp to module java.rmi at java.rmi.server.RMIClassLoader.initializeProvider(java.rmi@9-ea/RMIClassLoader.java:689) at java.rmi.server.RMIClassLoader.access$000(java.rmi@9-ea/RMIClassLoader.java:110) at java.rmi.server.RMIClassLoader$1.run(java.rmi@9-ea/RMIClassLoader.java:120) at java.rmi.server.RMIClassLoader$1.run(java.rmi@9-ea/RMIClassLoader.java:119) at java.security.AccessController.doPrivileged(java.base@9-ea/Native Method) at java.rmi.server.RMIClassLoader.<clinit>(java.rmi@9-ea/RMIClassLoader.java:118) at sun.rmi.server.MarshalInputStream.resolveProxyClass(java.rmi@9-ea/MarshalInputStream.java:256) at java.io.ObjectInputStream.readProxyDesc(java.base@9-ea/ObjectInputStream.java:1564) at java.io.ObjectInputStream.readClassDesc(java.base@9-ea/ObjectInputStream.java:1520) at java.io.ObjectInputStream.readOrdinaryObject(java.base@9-ea/ObjectInputStream.java:1779) at java.io.ObjectInputStream.readObject0(java.base@9-ea/ObjectInputStream.java:1356) at java.io.ObjectInputStream.readObject(java.base@9-ea/ObjectInputStream.java:368) at sun.rmi.registry.RegistryImpl_Stub.lookup(java.rmi@9-ea/Unknown Source) at java.rmi.Naming.lookup(java.rmi@9-ea/Naming.java:101)
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0
    Update Mockito to newest version.
  6. 0

    Apache reported the following regression issue with jdk 8 ea b111: Exception in thread "main" java.lang.IllegalAccessError: tried to access method java.lang.Object.clone()Ljava/lang/Object; from class TestCloneInterface at TestCloneInterface.test(TestCloneInterface.java:15) at TestCloneInterface.main(TestCloneInterface.java:19) The testcase TestCloneInterface.java is attached. Testcase appear to pass with jdk 8 ea b109 (and b110). Below is email from Apache: ---------------------------------------------------------------------------------------------------- Hi, I was able to reproduce with a simple test case that emulates the UIMA code. See attached test case, just compile it with any JDK and run with b111: With Java 7 or JDK8b109: > javac TestCloneInterface.java > java TestCloneInterface > With JDK8b111: > java TestCloneInterface Exception in thread "main" java.lang.IllegalAccessError: tried to access method java.lang.Object.clone()Ljava/lang/Object; from class TestCloneInterface at TestCloneInterface.test(TestCloneInterface.java:15) at TestCloneInterface.main(TestCloneInterface.java:19) > The bug happens if the clone() method is declared in a superinterface only. Without the additional interface inbetween, test passes. Instead of the real interface (the "o" local variable, which is of type "FoobarIntf") it checks access flags on "this", which is of type "TestCloneInterface". Uwe ----- Uwe Schindler uschindler@apache.org Apache Lucene PMC Chair / Committer Bremen, Germany http://lucene.apache.org/ -----------------------------------------------------------------------------------------------------------------

    JDK Bug System | 3 years ago | Balchandra Vaidya
    java.lang.IllegalAccessError: tried to access method java.lang.Object.clone()Ljava/lang/Object; from class org.apache.uima.analysis_engine.impl.AnalysisEngineImplBase at __randomizedtesting.SeedInfo.seed([BC36C2DC5FC6C107:4A94D14D35381F88]:0)

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalAccessError

      tried to access method java.lang.Object.clone()Ljava/lang/Object; from class Test

      at Test.main()
    2. Unknown
      Test.main
      1. Test.main(Test.java:15)
      1 frame