This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi I've got a question about weblogic 6.1. having 2 different EJB applications packaged in jar files, both deployed to same server, same domain. Can the 2 applications access each other class loader (and thus classes?) without altering server classpath? My guess is no I'm working on a project where there are two jar's deployed. First application with couple EJBs and util classes. Does not provide any direct services to clients. The second applications inherits from a bunch of classes in the first application and uses the services of the 2 EJBs it declares(logging and "wannabe-dynamic querying"). But the second jar does not contain any of the classes it inherits from. It seems to me the only way it works right now is that they(previous developers) have put both application jars in the servers own classpath(declared in the server startup startupscript). Second reason is that second Application is also using weblogics "startup class" facility to load certain resources on startup( in-house developed timer service). Since the startup class is in the applications jar file, it seems the whole jar had to be on the classpath. I haven't worked too much on EJB components, but from my experience with webapplications this seems like a really bad idea to me. Wouldn't it be better to include everything in one application Jar file, so it could be deployed everywhere? Am I correct or am I just crazy? While thing seems like a hack to me. Is this a common deployment approach on real life servers? comments?
My guess is Yes. I think that each ejb jar file is loaded within the same classloader. So there should be no difference if you package all ejb's in one jar file or have multiple ejb jar files.
Classloaders in Weblogic Server are hierarchical. When you start WebLogic Server, the Java system classloader is active and is the parent of all subsequent classloaders that WebLogic Server creates. When WebLogic Server deploys an application, it automatically creates two new classloaders: one for EJBs and one for Web applications. The EJB classloader is a child of the Java system classloader and the Web application classloader is a child of the EJB classloader.
Joined: Jan 29, 2004
The thing is the 2 jars represents 2 different applications, each with an entry in config.xml. So a.jar and b.jar is application a and b. Now there are only ejbs in these jars, so one classloader for application a and one for b. How can then application b access classes in application a. That's why I though no.