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

Error occurred during initialization of VM #200

Open
RTxin opened this issue Aug 24, 2023 · 4 comments
Open

Error occurred during initialization of VM #200

RTxin opened this issue Aug 24, 2023 · 4 comments

Comments

@RTxin
Copy link

RTxin commented Aug 24, 2023

I want to know what steps I have missed to make it impossible to run?

I use JDK11 (Openjdk-11.0.20) to run `MVN Install·

  1. java -jar phosphor-instrument-jigsaw/target/phosphor-instrument-jigsaw-0.1.0-SNAPSHOT.jar D:\my_home\jdks\jdk-11.0.20 jre-inst
  2. java -jar Phosphor/target/Phosphor-0.1.0-SNAPSHOT.jar D:\project\application\target\my.jar output-path-for-instrumented-code

The above two steps are correct

  1. cd jre-inst/bin
  2. java -javaagent:../../phosphor-jigsaw-javaagent/target/phosphor-jigsaw-javaagent-0.1.0-SNAPSHOT.jar -cp D:\phosphor\output-path-for-instrumented-code\my.jar cn.vulns.VulnsApplication.class

This is where the error below occurs

Error occurred during initialization of VM
java.lang.NoSuchMethodError: jdk.internal.misc.Unsafe.putReferenceVolatile(Ljava/lang/Object;JLjava/lang/Object;)V
        at edu.columbia.cs.psl.phosphor.runtime.RuntimeJDKInternalUnsafePropagator.compareAndSetInt(java.base/RuntimeJDKInternalUnsafePropagator.java:783)
        at java.util.concurrent.ConcurrentHashMap.initTable(java.base/ConcurrentHashMap.java:2288)
        at java.util.concurrent.ConcurrentHashMap.putVal(java.base/ConcurrentHashMap.java:1017)
        at java.util.concurrent.ConcurrentHashMap.put(java.base/ConcurrentHashMap.java:1006)
        at java.util.Properties.put(java.base/Properties.java:1329)
        at java.util.Properties.put(java.base/Properties.java)
        at java.lang.System.initProperties(java.base/Native Method)
        at java.lang.System.initProperties(java.base/System.java)
        at java.lang.System.initPhase1(java.base/System.java:1959)
        at java.lang.System.initPhase1(java.base/System.java)

image

@RTxin
Copy link
Author

RTxin commented Aug 25, 2023

According to the jdk8 enhancement steps mentioned in the README file, the following error will occur

  1. java -jar Phosphor/target/Phosphor-0.1.0-SNAPSHOT.jar D:\jdks\corretto-1.8.0_332 jre-inst
  2. export JAVA_HOME=jre-inst/
  3. $JAVA_HOME/bin/java -Xbootclasspath/a:D:\project\phosphor\Phosphor\target\Phosphor-0.1.0-SNAPSHOT.jar -javaagent:D:\project\phosphor\Phosphor\target\Phosphor-0.1.0-SNAPSHOT.jar -cp output-path-for-instrumented-code\xmgoat.jar Application.class
    image
phosphor\jre-inst\bin>java  -Xbootclasspath/a:Phosphor\target\Phosphor-0.1.0-SNAPSHOT.jar -javaagent:Phosphor\target\Phosphor-0.1.0-SNAPSHOT.jar -cp output-path-for-instrumented-code\xmgoat.jar cn.zho.Application.class
Error occurred during initialization of VM
java.lang.ExceptionInInitializerError
        at java.io.WinNTFileSystem.hashCode(WinNTFileSystem.java:698)
        at java.io.File.hashCode(File.java:2171)
        at java.io.File.hashCode(File.java)
        at java.util.HashMap.hash(HashMap.java:340)
        at java.util.HashMap.put(HashMap.java:613)
        at sun.misc.MetaIndex.registerDirectory(MetaIndex.java:190)
        at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java:157)
        at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java:152)
        at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessController.doPrivileged(AccessController.java)
        at sun.misc.Launcher$ExtClassLoader.createExtClassLoader(Launcher.java:151)
        at sun.misc.Launcher$ExtClassLoader.getExtClassLoader(Launcher.java:138)
        at sun.misc.Launcher.<init>(Launcher.java:68)
        at sun.misc.Launcher.<clinit>(Launcher.java:54)
        at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1444)
        at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1429)
        at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java)
Caused by: java.lang.ClassCastException: edu.columbia.cs.psl.phosphor.struct.PowerSetTree$SetNode cannot be cast to java.util.concurrent.ConcurrentHashMap$Node
        at java.util.concurrent.ConcurrentHashMap.tabAt(ConcurrentHashMap.java:755)
        at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1018)
        at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
        at sun.util.locale.LocaleObjectCache.put(LocaleObjectCache.java:87)
        at sun.util.locale.BaseLocale.createInstance(BaseLocale.java:69)
        at java.util.Locale.createConstant(Locale.java:709)
        at java.util.Locale.<clinit>(Locale.java:498)
        at java.io.WinNTFileSystem.hashCode(WinNTFileSystem.java:698)
        at java.io.File.hashCode(File.java:2171)
        at java.io.File.hashCode(File.java)
        at java.util.HashMap.hash(HashMap.java:340)
        at java.util.HashMap.put(HashMap.java:613)
        at sun.misc.MetaIndex.registerDirectory(MetaIndex.java:190)
        at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java:157)
        at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java:152)
        at sun.misc.Launcher$ExtClassLoader$1.run(Launcher.java)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessController.doPrivileged(AccessController.java)
        at sun.misc.Launcher$ExtClassLoader.createExtClassLoader(Launcher.java:151)
        at sun.misc.Launcher$ExtClassLoader.getExtClassLoader(Launcher.java:138)
        at sun.misc.Launcher.<init>(Launcher.java:68)
        at sun.misc.Launcher.<clinit>(Launcher.java:54)
        at java.lang.ClassLoader.initSystemClassLoader(ClassLoader.java:1444)
        at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java:1429)
        at java.lang.ClassLoader.getSystemClassLoader(ClassLoader.java)

@jon-bell
Copy link
Collaborator

Could you please try on Linux or MacOS? It is difficult for me to provide support for running this on Windows.

@wangmanyou
Copy link

I get this error after completing the instrument for jre

Error occurred during initialization of VM
java/lang/NoClassDefFoundError: edu/columbia/cs/psl/phosphor/struct/TaintedWithObjTag

@jon-bell
Copy link
Collaborator

@wangmanyou - It is extremely difficult to diagnose what went wrong when you only post this error. Please copy/paste the textual commands that you ran (from instrumenting the JVM to running), and all of their output.

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

3 participants