Cross ClassLoader instrumentation issue

Nemo Caviani <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <[email protected]>
Hi all,

I have a rather complicated problem that I am trying to deal with.

I am doing binary rewriting within the context of Spring DM and the issue
that I am dealing with is that several instances of an overwritten
ClassLoader load different classes in the application. So, when I am doing
binary rewriting some classes are not available for the class loader whose
class byte code is being rewritten. This corrupts the overwritten bytecode
for the instrumented class and when I check it with the CheckClassAdapter
verifier, I receive exceptions similar to the following:

org.objectweb.asm.tree.analysis.AnalyzerException: Error at instruction 392:
java.lang.ClassNotFoundException: org.hibernate.HibernateException

when checking the Class loader IDs for which the classes are being loaded, I
see the following

org.apache.felix.framework.ModuleImpl$ModuleClassLoader 8993129 ::
Auth.class
org.apache.felix.framework.ModuleImpl$ModuleClassLoader 16865950
:: org.hibernate.HibernateException

"Auth.class" is loaded via a ModuleClassLoader instance whose hashcode
is 8993129 whereas the instance loading
"org.hibernate.HibernateException.class" has the hashcode 16865950
(Basically 2 different instances)

I wonder if there is any way to get the ClassAdapter to do late binding when
resolving dependencies? or if not, could anyone think of any solution?

One possibility that I have been thinking about is to exhaustively find all
the classes  in the byte code of the class being overwritten and create some
proxies or interfaces for them to resolve the dependencies but this is
insanely expensive and fairly complicated. I very much appreciate inputs
from you guys.

thanks a lot,
Nemo
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.