Discussion:
[jboss-user] [Javassist] - Javaassist and Java Web Start. Its posible?
Telcontar Thorongil
2013-02-27 16:23:55 UTC
Permalink
Telcontar Thorongil [https://community.jboss.org/people/telcontarvi] created the discussion

"Javaassist and Java Web Start. Its posible?"

To view the discussion, visit: https://community.jboss.org/message/799924#799924

--------------------------------------------------------------
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?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/799924#799924]

Start a new discussion in Javassist at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2062]
Telcontar Thorongil
2013-03-05 11:59:13 UTC
Permalink
Telcontar Thorongil [https://community.jboss.org/people/telcontarvi] created the discussion

"Re: Javaassist and Java Web Start. Its posible?"

To view the discussion, visit: https://community.jboss.org/message/800773#800773

--------------------------------------------------------------
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))
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/800773#800773]

Start a new discussion in Javassist at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2062]
Loading...