Hi, i'm triying to deploy a desktop application with one class modified at runtime by javaassist. In my computer it's working fine, but when i deploy and start it by Java Web Start i'm facing several problems, last of them i can't resolve:
- First: ClassPool didnt found the class to modify, it was fixed by cp.insertClassPath(new ClassClassPath(XXXXX.class));
- Second: All .jar of an Java Web Start application must be signed by one and only one certificate, but when javaassist modify the class at runtime i supose the sign it's gone or it's invalid, so that this exception is launched:
java.lang.SecurityException: class "com.sch.coberturas.db.CobDao"'s signer information does not match signer information of other classes in the same package
Solved by isolating
com.sch.coberturas.db.CobDao in a package with only this class in it
- Third: I suposse that Java Web Start detects that the modified class is not signed, or it's sign it's not valid and revokes permissions to the application so it can't do things like connecting to the database or to write files, making the app useless.
How can i solve this third problem?
Hi, this was solved thans to StackOverflow. com
instead of using CtClass.toClass() use
ClassPool.toClass(CtClass ct, java.lang.ClassLoader loader, java.security.ProtectionDomain domain))