I start rmiregistry.exe on required port and execute code below. However, exception is thrown. I use cglib and, I guess, this is somehow related to classloaders.
When the same code is executed...