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

jdk 11下面出错 #11

Open
hengyunabc opened this issue Apr 7, 2020 · 1 comment
Open

jdk 11下面出错 #11

hengyunabc opened this issue Apr 7, 2020 · 1 comment

Comments

@hengyunabc
Copy link
Owner

因为即使加了各种的 --add-exports,在 jdk.hotspot.agent 里,是在 sun.jvm.hotspot.tools.jcore.ClassDump.run() 里 ,用Class.forName 来加载filter类的。用户自定义的类加载不到。

    public void run() {
        // Ready to go with the database...
        try {
            if (classFilter == null) {
                // If not already set, the name of the filter comes from a System property.
                // If we have a pkgList, pass it, otherwise let the filter read
                // its own System property for the list of classes.
                String filterClassName = System.getProperty("sun.jvm.hotspot.tools.jcore.filter",
                                                            "sun.jvm.hotspot.tools.jcore.PackageNameFilter");
                try {
                    Class filterClass = Class.forName(filterClassName);
                    if (pkgList == null) {
                        classFilter = (ClassFilter) filterClass.newInstance();
                    } else {
                        Constructor con = filterClass.getConstructor(String.class);
                        classFilter = (ClassFilter) con.newInstance(pkgList);
                    }
                } catch(Exception exp) {
                    System.err.println("Warning: Can not create class filter!");
                }
            }

/Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home/bin/java --add-modules ALL-SYSTEM --add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.runtime=ALL-UNNAMED --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.memory=ALL-UNNAMED --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED --add-exports=jdk.hotspot.agent/sun.jvm.hotspot.tools.jcore=ALL-UNNAMED sun.jvm.hotspot.tools.jcore.ClassDump

http://hengyunabc.github.io/dumpclass/

@hengyunabc
Copy link
Owner Author

/Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home/bin/jhsdb hsdb

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

1 participant