Mantis - Resin
Viewing Issue Advanced Details
3339 feature always 02-12-09 04:35 02-25-09 15:33
toomasr  
ferg  
normal  
closed 3.2.1  
fixed  
none    
none 4.0.0  
0003339: JavaRebel & Resin integration hurdles
JavaRebel has supported Resin 3.0 with a simple runtime patch, http://code.google.com/p/zt-oss/source/browse/JavaRebelUtils/trunk/src/org/zeroturnaround/javarebel/integration/generic/FindClassClassBytecodeProcessor.java [^]
This is used to runtime patch com.caucho.loader.DynamicClassLoader. Everything used to work great.

However starting with version 3.1 Resin startup has gone through a lot of changes. First a daemon WatchDog is spawned which spawns another process with the -Djava.system.class.loader=com.caucho.loader.SystemClassLoader

As SystemClassLoader extends EnvironmentClassLoader which extends DynamicClassLoader we cant patch the DynamicClassLoader as it is loaded before the javaagent is even initialized. There are some workarounds available for us to still patch the classloader before it is loaded, but they are unnecessarily complicated to make and maintain.

Therefore we would like to ask you to help us support the Resin JavaRebel users:
*) Can you make the SystemClassLoader standalone? Not extending the other classloaders in such a way, so that it would be possible to do runtime patching without the trouble.
*) Maybe you are willing to integrate with us? We can provide you a patch but you'll have to depend on our OSS SDK (http://repos.zeroturnaround.com/maven2/org/zeroturnaround/javarebel-sdk/) [^] for building.

Thanks!

Notes
(0003830)
ferg   
02-18-09 10:27   
Can you give me some details on the patch?

We can compile and release integration jars as part of our release (we create artifact jars and publish them to our maven repository.) So it's perfectly fine for us to create a classloader that extends from our SystemClassLoader and use that for launching Resin. (We might need to add a configuration item to select the system classloader, but that's easy.)

That sounds like the simplest way of handling this case, but I'm not sure if you have other requirements to make the system work.
(0003840)
ferg   
02-25-09 15:33   
php/2l73

Adding a <system-class-loader> configuration in the <server> or <server-default>, so a user can specify the system classloader to use. In the case of JavaRebel, this would be a classloader extending com.caucho.loader.SystemClassLoader which overrides methods as needed for JavaRebel.