3 Replies Latest reply on May 4, 2006 3:43 PM by William DeCoste

    EJB3 access and classloader

    Yuan Ye Newbie

      I have an impression that in Tomcat, each war file is deployed by its own classloader, so a class in one war file can't see the class in another war file, is this correct?
      I am assuming the same architecture with JBoss server, at runtime one class can not see another class if they belong to two different .ejb3 files. However after some tests, seems Jboss is using a single classloader for all .ejb3 files. Is that true? (I am using Jboss 4.0.3SP1 + EJB3_RC6)

      Here is my test case:
      EJB1:
      Define a staleless session bean with name "CalculatorBean" which implements interface "Calculator"

      EJB2:
      Define another staleless session bean containing the following code:

      code:
      --------------------------------------------------------------------------------

      Calculator calculator = (Calculator) ctx.lookup("CalculatorBean/local");

      --------------------------------------------------------------------------------



      Since EJB2 file doesn't contain any class with name "Calculator", I was assuming it will throw ClassNotFoundException at runtime. But it turns out everything works fine in EJB2. So I guess the session bean in EJB2 can access classes in EJB1 directly, is that true?