THanks. Nice page!! that says a lot of stuff that I just spent a couple days figuring out in the code. was that out on the old site?? I feel dumb now. I will try to limit dumb questions in the future. New site is looking great! Javadocs for minerva! woohoo! will we get javadocs for everything?? dtd links in faq still broken but otherwise this is gorgeous. go marc!! -----Original Message----- From: Sebastien Alborini To: jBoss Developer Sent: 2/8/01 5:13 AM Subject: Re: [jBoss-Dev] problem with j2ee deployment - optimized code not running Hi David, see http://www.jboss.org/newsite/documentation/J2eeDeployment_howto.html there is a part called "understanding the shared classloader architecture in JBoss" (to make it short, all components use different classloaders, but these classloaders have the same parent) Sebastien Castro, David wrote: > > Running the integrated jboss with tomcat, I noticed that I was getting a lot > of serialization going on, so I started digging through the code to find out > what was going on. After looking at it for a long time, however, I dont > understand how (using an ear file) the optimized code could ever run between > ejb jars and war files. Im hoping that someone can explain this to me. > line numbers are from most recent snapshot, but the code is essentially the > same in 2.0 FINAL > > In org/jboss/ejb/plugins/jrmp/server/JRMPContainerInvoker.java is the code > that determines whether or not we will run optimized: (line 419 for the > invoke function) > > if > (!m.getDeclaringClass().isAssignableFrom(((ContainerInvokerContainer)con tain > er).getRemoteClass())) > > (then serialize, otherwise don't serialize) > > Or line 382 for the invokeHome function, same thing except with home > interface. > > which makes sense - if the class being returned isnt assignable locally, > then wed better serialize. Since the class is the same in both cases (ie. > the ejb home or remote interface), the key is whether they were loaded by > the same classloader. The local class was loaded by the calling > ejb/servlet(tomcat), the remote by the ejb being called. > > Here's why I dont see how this can ever work. every ejb has its own > classloader, which is created in org/jboss/ejb/ContainerFactory.java (line > 331), and which sees only the ejb-jar file for that ejb. and the web > context has a different classloader, which is created in > org/jboss/deployment/J2eeDeployer.java (line 589), and which sees all of the > ejb jars for the entire application. since every component has its own > classloader it seems as though the serialization would be necessary in all > calls between components. > > Hopefully at this point someone will tell me Im an idiot and explain why the > optimization works fine. Im assuming this will happen because people have > said that they have made the optimized code work. If I am right, I dont > really see any way to fix it, except by passing the j2ee classloader to all > the ejb containers as well as to tomcat, so that everyone will see the same > classloader. This would mean that the individual ejb-jars would see each > others code, instead of each jar just seeing the classes that it contains.
