Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal Access Error #16

Open
amitrege opened this issue Jul 4, 2019 · 6 comments
Open

Illegal Access Error #16

amitrege opened this issue Jul 4, 2019 · 6 comments

Comments

@amitrege
Copy link

amitrege commented Jul 4, 2019

Hi,
When I run java -cp ./instrumentor/build/libs/kelinci.jar edu.cmu.sv.kelinci.instrumentor.Instrumentor -i ../bin -o ../bin-instrumented I get the following error

Loading dir: ../bin Found file ../bin/sorting_algo/sorting.class Found file ../bin/Driver.class WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by edu.cmu.sv.kelinci.instrumentor.Options (file:/home/amit/dev-work/Cost_Model_NN/new_fuzzing/kelinci/instrumentor/build/libs/kelinci.jar) to method java.net.URLClassLoader.addURL(java.net.URL) WARNING: Please consider reporting this to the maintainers of edu.cmu.sv.kelinci.instrumentor.Options WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release Exception in thread "main" java.lang.RuntimeException: Error adding location to class path: ../bin at edu.cmu.sv.kelinci.instrumentor.Options.addToClassPath(Options.java:62) at edu.cmu.sv.kelinci.instrumentor.Options.getInput(Options.java:46) at edu.cmu.sv.kelinci.instrumentor.Instrumentor.main(Instrumentor.java:43)

I have tried changing my JDK from 11 to 8 but I still get the same error. Any ideas on how to fix this?

Thanks

@escube
Copy link

escube commented Oct 24, 2019

Same thing here, did you manage to fix it?

After trying to see what is the source of the problem, seems to be line 60, the invoke_method fails.
Adding a printstacktrace to the catch exception, gives me the following stacktrace :

java.lang.IllegalArgumentException: object is not an instance of declaring class
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at edu.cmu.sv.kelinci.instrumentor.Options.addToClassPath(Options.java:59)
at edu.cmu.sv.kelinci.instrumentor.Options.getInput(Options.java:45)
at edu.cmu.sv.kelinci.instrumentor.Instrumentor.main(Instrumentor.java:43)

@escube
Copy link

escube commented Oct 24, 2019

I solved the problem in this way :

  1. Removed all library from -cp command and left only kelenci.
    At this point I had another exception that is :
    java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.(Unknown Source)
    at org.objectweb.asm.ClassReader.(Unknown Source)
    at org.objectweb.asm.ClassReader.(Unknown Source)
    at edu.cmu.sv.kelinci.instrumentor.Instrumentor.main(Instrumentor.java:55)

The excpetion was not very clear, so I updated org.ow2.asm from version 5.2 to version 7.2.

It is compiling fine now.

@krisohotski
Copy link

krisohotski commented Jan 29, 2020

adding "--illegal-permit access" at the end of the cmd seems to fix this issue.

@shijy16
Copy link

shijy16 commented Jul 3, 2020

I fixed the bug by using java8 instead of other versions.

@YJDave
Copy link

YJDave commented Jul 22, 2020

I was getting same error, changing to java8 version worked.
Thank you @shijy16

@WayneDevMaze
Copy link

change to java8, worked!!!

  1. install 安装
    sudo apt-get install openjdk-8-jdk

  2. change version 变化Java版本
    sudo update-java-alternatives -s java-8-oracle
    图片
    注:变更版本可以在这里查看 ls /usr/lib/jvm/java-8-oracle

  3. 重新执行,执行一定要sudo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants