0 Replies Latest reply on Aug 20, 2004 8:55 AM by Bruce Wilson

    Classloading problems betw EJBs and WARs

    Bruce Wilson Newbie

      I'm deploying several web applications on JBoss 3.0.7 running on Solaris.
      These web applications share some EJBs which are deployed in a separate
      EAR. The EJBs in the EAR share some common core classes (value objects,
      PKs, exceptions) which are packaged in a "support" jar which is then
      referenced in the manifest classpath of each EJB jar. The support jar
      is also copied to each of the WARs' WEB-INF/lib directories so that the
      web applications also have access to these common classes. Each EJB jar
      also has a companion client jar containing just the remote and home
      interfaces of each EJB; these are also copied to both the WAR lib directories
      and the EAR directory.

      This setup has worked for about a year now, and now all of a sudden we're
      getting linkage errors and class cast exceptions on just one of our lab
      test machines. Other machines running a very similar build are working OK.
      The class that's involved in the errors appears to be one of the classes
      in the common support jar.

      I read the document by Scott Stark on classloading quite a while back,
      and recall that linkage errors and class cast errors can be an indication
      of classloading problems. But what am I doing wrong here ? I think that
      the kinds of things that I'm doing, separate support jar mentioned on
      manifest classpath, and separate client jars for interfaces, is pretty
      common usage these days. Anyone have any problems using a similar
      approach ?

      EAR:
      --> MyEjb1.jar
      --> META-INF/MANIFEST.MF
      --> Class-Path: EjbSupport.jar OtherEjbClient.jar
      MyEjb1Impl.class
      --> EjbSupport.jar
      --> SessionLocator.class
      --> CommonPK.class
      --> AppSpecificException.class
      --> MyEjb1Client.jar
      --> MyEjb1Home.class
      --> MyEjb1Remote.class
      --> OtherEjbClient.jar
      --> OtherEjbHome.class
      --> OtherEjbRemote.class
      ...and so on...

      WAR:
      --> WEB-INF
      --> lib
      --> MyGuiServlets.jar
      --> CompiledJSPs.jar
      --> EjbSupport.jar
      --> MyEjb1Client.jar
      --> OtherEjbClient.jar