wood burning stoves
The moose likes BEA/Weblogic and the fly likes weblogic applications classloader question and good practice? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "weblogic applications classloader question and good practice?" Watch "weblogic applications classloader question and good practice?" New topic

weblogic applications classloader question and good practice?

Henrik Bentel

Joined: Jan 29, 2004
Posts: 6
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?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Moving to the BEA/WebLogic forum...
Rahul Mahindrakar
Ranch Hand

Joined: Jul 28, 2000
Posts: 1868
Hi Henrik
Here is the appropriate weblogic documentation.

My guess is no

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.
Henrik Bentel

Joined: Jan 29, 2004
Posts: 6
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.
I agree. Here's the link: http://aspose.com/file-tools
subject: weblogic applications classloader question and good practice?
It's not a secret anymore!