Comments (7)
Is TestDog2#transform() invoked when com/CertShim/Dog is loaded?
from javassist.
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.
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.
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.
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.
@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.
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)
- How to get all annotations declared on a class
- org.springframework.transaction.annotation.Transactional
- "NEW followed by no DUP was found" check is probably not necessary
- Exception: java.lang.reflect.InaccessibleObjectException: Unable to make protected
- java.lang.ClassFormatError: Truncated class file HOT 1
- Add contributing and other community docs to javassist
- HotSwapper Cannot be used multiple times
- Triple Licensing HOT 3
- feature request: support for adding Annotations to dynamic Proxies
- How want insert Runnable HOT 1
- Complete example.md
- In Java21, the ConstPool API throws NPE for MethodParameters attributes without parameter names
- NPE of javassist.bytecode.stackmap.TypeData HOT 1
- Can I restore a line bytecode after transformed?
- Bad OSGi metadata in https://repo1.maven.org/maven2/org/javassist/javassist/3.30.0-GA HOT 9
- License condition HOT 4
- Replacing a method call to a private static function of an outer class from within an inner class leads to NoSuchMethodError
- javassist creates invalid class files for Java records when injecting static fields and adding static initializer code
- Request for posting of Maven signing key(s) HOT 2
- Asking about licenses issue HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javassist.