Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-3727

NPE on context classloader changing in EJB container when caller doesn't have a context classloader

    XMLWordPrintable

    Details

      Description

      The following code in org.jboss.ejb.Container
      doesn't work if the caller doesn't have a context classloader,
      e.g. it is using the bootstrap classloader as its classloader on the Sun JDK

      ClassLoader callerClassLoader = SecurityActions.getContextClassLoader();
      long start = System.currentTimeMillis();
      Method m = null;

      boolean setCl = false;
      Object type = null;
      String contextID = getJaccContextID();
      try
      {
      if (!callerClassLoader.equals(classLoader)) // !!! callerClassLoader is null !!!

      { setCl = true; SecurityActions.setContextClassLoader(this.classLoader); }

      The classloaders should be reversed, since the ejb classloader can never be null.

      Is there a reason for this optimization? I'd imagine the comparison of classloaders
      is likely to be more expensive that just setting the TCL in some cases????

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                dimitris Dimitrios Andreadis
                Reporter:
                adrian.brock Adrian Brock
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: