Coder Social home page Coder Social logo

Comments (7)

chibash avatar chibash commented on July 19, 2024

Is TestDog2#transform() invoked when com/CertShim/Dog is loaded?

from javassist.

akatsuki521 avatar akatsuki521 commented on July 19, 2024

I don't think so, when com/CertShim/Dog comes, it will simply return null. I add a print command after the return null in the try block. Only the desired two class name can be printed.

Maybe my title isn't appropriate, I didn't mean there is any problem with javassist. I just want to know where did I use this tool incorrectly. Sorry about that.
BTW, I'm using JDK 7.

from javassist.

chibash avatar chibash commented on July 19, 2024

OK, so it's not a problem of Javassist.

I guess that security-related (or system) classes are loaded by the system loader different from the loader
for other classes like com.CertShim.Dog. Also, a class referred to in a security class is loaded by
the system loader. So, if the system class loader cannot find the Dog class, an error will be thrown.
I suppose the system class loader only searches rt.jar.

from javassist.

akatsuki521 avatar akatsuki521 commented on July 19, 2024

Thanks for the reply.
I want to revise my previous comment.
I added a print command before the try. "com/CertShim/Dog" is not loaded at all. That's why the exception happens.

from javassist.

akatsuki521 avatar akatsuki521 commented on July 19, 2024

I made some attempts by putting Dog class into system jars. I put it into the rt.jar and jsse.jar with the my path name, same problem still happen. If I put the dog class in the same package with the X509TrustManagerImpl, it will bark() normally. So do you think there might be some other reasons about this problem?
Thanks.

from javassist.

akatsuki521 avatar akatsuki521 commented on July 19, 2024

@chibash
I find this link(https://bugs.openjdk.java.net/browse/JDK-4405095) that might bring some insight into this problem. From this sentence "JSSE and JCE need their own jar files due to export/import related issues. So the VM has to be changed to pick up the JSSE and JCE jar files. This is just like that VM had to be changed to pick up the Sun RSA provider." So I guess the class needed by jsse classes are treated specially. Unfortunately, I'm not familiar with JVM. Do you think there is a way to work around this problem?
Thanks.

from javassist.

akatsuki521 avatar akatsuki521 commented on July 19, 2024

Problem solved, thank you for directing me to the classloader. The jsse.jar and classes used by jsse.jar is loaded by bootstrap classloader. And bootstrap loader only load specific classes. So self injected class won't be loaded. By using "-Xbootclasspath/a" parameter, I can add classpath to the bootstrap classloader.

from javassist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.