Dain, basically explained. I had a look at the source. JBoss uses a 'special' class loader to dynamically generate a 'byte code' class presumably 'wrapper' the ejb abstract class before it is instantiated. Very clever! Kar ----- Original Message ----- From: "Andreas Joseph Krogh" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, September 24, 2001 5:56 PM Subject: RE: [JBoss-user] EJB 2.0 CMP implementation class must be abstrac t
Dain Sundstrom <[EMAIL PROTECTED]> said: > > > According to this article > > > http://developer.java.sun.com/developer/technicalArticles/ebeans/ejbmigrate/ > ?frontpage-jdc > > an EJB 2.0 CMP bean implementation class must be abstract, will it > > work in JBoss? > > Yes. > > > As I understand it JBoss does not generate "wrapper" class instead > > it uses the Proxy class to "wrap" the bean, the call to > > Class.newInstance() will not work on an abstract class. I am just > > wondering how it is done. > > Kar > > You got it half right. We use a proxy class, but the proxy does not as you > put it, "wrap the bean." JBoss uses dynamic proxies > (java.lang.reflect.Proxy). Read the javadocs, but to summarize, a dynamic > proxy is a lot of black magic that code generates the byte code for a class > that implements an arbitrary set of interfaces. For CMP JBoss uses a custom > implementation of dynamic proxies that will generate a proxy that is a > subclass of an abstract class. > > It is pretty simple except for the code that generates the proxy, which I > didn't write. I thought the dynamic proxy thing wouldn't work with CMP-2.0 and that JBoss would seriously suffer from this as SUN wouldn't take it out of the spec. Can you/anyone please elaborate more on this, and how JBoss solved it? -- Andreas Joseph Krogh <[EMAIL PROTECTED]> _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user