6 Replies Latest reply on Mar 7, 2006 12:06 PM by Scott Stark

    Classloading and multiple non-isolated EARs

    Jeff Schnitzer Newbie

      I just read the (great!) article http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossClassLoadingUseCases and wanted to verify that I understand a few things correctly.

      My goal is to have two EARs which invoke each other and share many classes. In one deployment scenario, both EARs will be deployed into a single JBoss instance. In another deployment scenario, they will be located on different instances within a cluster.

      The logical thing to do, it would seem, would be to package complete EARs, each of which contain full copies of all the "shared" classes and libraries. If I have read the JBossClassLoadingUseCases article correctly, the existance of these duplicate classes within a single JBoss instance will not be an issue - the class repository will contain only one instance of each loaded class, and as long as the duplicate classes are identical my applications will never be the wiser. It will all magically just work as long as both applications have the same versions of every library and class.

      True?

      Next question: Since remoteness is one of the deployment scenarios, application A will have to be written to use application B's remote interface. When both applications are deployed within the same JBoss instance, will JBoss optimize the remote invocation to a local by-reference invocation and skip the expensive marshalling? Or do I need to have the code perform some sort of detection to determine which interface to use? If so, how do I detect that?

      Thanks in advance!

      Jeff Schnitzer