private Class<?> loadGeneratedClass(ClassLoader classLoader,
                                        String className,
                                        NameUtil nameUtil) throws ClassNotFoundException {
        if (className == null)
            return null;

        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        Class<?> loadedClass = null;
        String loadClassName = className;

        // Exception to throw if we can not load the class and we can not
        // determine name of generated class. Not thrown if this method is
        // able to return the loaded Class object.
        ClassNotFoundException primaryException = new ClassNotFoundException(className); // F743-1752.1

        // -----------------------------------------------------------------------
        // First, try and load the class using the class name as specified.
        //
        // This is different than previous releases, where the hash suffix
        // was first added for EJB 1.1 classes.  Instead, the hash suffix
        // is being added automatically by NameUtil for EJB 1.1 class names,
        // so it doesn't need to be done here any more.
        // -----------------------------------------------------------------------
        if (isTraceOn && tc.isDebugEnabled())
            Tr.debug(tc, "loadGeneratedClass: Loading class = " + loadClassName);

        try {
            loadedClass = classLoader.loadClass(loadClassName);
        } catch (ClassNotFoundException cnfe) {
            // Do not FFDC log this, as this is a normal exception when the
            // class was generated with an older version of EJBDeploy
            // FFDCFilter.processException(ex, CLASS_NAME + ".loadGeneratedClass", "4458");
            primaryException = cnfe;
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "loadGeneratedClass: load failed: " + cnfe);
        }

        // -----------------------------------------------------------------------
        // Second, try and load the class using the modified BuzzHash suffix.
        //
        // For performance, the call to NameUtil to get the modified hash suffix
        // will change the state of the NameUtil instance so that subsequent
        // names obtained for this EJB will use the modified suffix... and the
        // subsequent classes will be loaded by the first attempt above,
        // reducing the number of ClassNotFoundExceptions.
        // -----------------------------------------------------------------------
        if (loadedClass == null) {
            loadClassName = nameUtil.updateFilenameHashCode(loadClassName);
            if (loadClassName != null) {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "loadGeneratedClass: Loading class = " + loadClassName);
                try {
                    loadedClass = classLoader.loadClass(loadClassName);
                } catch (ClassNotFoundException cnfe) {
                    // Do not FFDC log this, as this is a normal exception when the
                    // class was generated with an older version of EJBDeploy
                    // FFDCFilter.processException(ex, CLASS_NAME + ".loadGeneratedClass", "378");
                    primaryException = cnfe; // F743-1752.1
                    if (isTraceOn && tc.isDebugEnabled())
                        Tr.debug(tc, "loadGeneratedClass: load failed: " + cnfe);
                }
            }
        }

        // -----------------------------------------------------------------------
        // Third, try and load the class using the EJB 1.1 original class name
        // (i.e. contained no hashcode suffix). The updated name will be null
        // for EJB 2.0 and later module levels.
        //
        // For performance, the call to NameUtil to remove the hash suffix
        // will change the state of the NameUtil instance so that subsequent
        // names obtained for this EJB will contain no suffix... and the
        // subsequent classes will be loaded by the first attempt above,
        // reducing the number of ClassNotFoundExceptions.
        // -----------------------------------------------------------------------
        if (loadedClass == null) {
            loadClassName = nameUtil.updateFilenameHashCode(loadClassName);
            if (loadClassName != null) {
                if (isTraceOn && tc.isDebugEnabled())
                    Tr.debug(tc, "loadGeneratedClass: Loading class = " + loadClassName);
                try {
                    loadedClass = classLoader.loadClass(loadClassName);
                } catch (ClassNotFoundException cnfe) {
                    // Do not FFDC log this, as it will be logged by the caller
                    // FFDCFilter.processException(ex, CLASS_NAME + ".loadGeneratedClass", "4520");
                    primaryException = cnfe; // F743-1752.1
                    if (isTraceOn && tc.isDebugEnabled())
                        Tr.debug(tc, "loadGeneratedClass: load failed: " + cnfe);
                }
            }
        }

        // -----------------------------------------------------------------------
        // Finally, insure an exception is thrown if none of the class load
        // attempts were successful.
        // -----------------------------------------------------------------------
        if (loadedClass == null) {
            if (isTraceOn && tc.isDebugEnabled())
                Tr.debug(tc, "loadGeneratedClass: all attempts failed: " + primaryException);

            throw primaryException;
        }

        return loadedClass;

    }
private Class < ? > loadGeneratedClass ( ClassLoader classLoader , String className , NameUtil nameUtil ) throws ClassNotFoundException { if ( className == null ) return null ; final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; Class < ? > loadedClass = null ; String loadClassName = className ; ClassNotFoundException primaryException = new ClassNotFoundException ( className ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "loadGeneratedClass: Loading class = " + loadClassName ) ; try { loadedClass = classLoader . loadClass ( loadClassName ) ; } catch ( ClassNotFoundException cnfe ) { primaryException = cnfe ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "loadGeneratedClass: load failed: " + cnfe ) ; } if ( loadedClass == null ) { loadClassName = nameUtil . updateFilenameHashCode ( loadClassName ) ; if ( loadClassName != null ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "loadGeneratedClass: Loading class = " + loadClassName ) ; try { loadedClass = classLoader . loadClass ( loadClassName ) ; } catch ( ClassNotFoundException cnfe ) { primaryException = cnfe ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "loadGeneratedClass: load failed: " + cnfe ) ; } } } if ( loadedClass == null ) { loadClassName = nameUtil . updateFilenameHashCode ( loadClassName ) ; if ( loadClassName != null ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "loadGeneratedClass: Loading class = " + loadClassName ) ; try { loadedClass = classLoader . loadClass ( loadClassName ) ; } catch ( ClassNotFoundException cnfe ) { primaryException = cnfe ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "loadGeneratedClass: load failed: " + cnfe ) ; } } } if ( loadedClass == null ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "loadGeneratedClass: all attempts failed: " + primaryException ) ; throw primaryException ; } return loadedClass ; }
Loads classes generated by EJBDeploy. Returns null if the specified
class name to load is null. <p>

The algorithm used to determine the generated class names has changed
over time, and this method will account for all of the possible
names that may be present in the current EJB jar file. <p>

The first time this method is called for a particular EJB, the
className parameter is expected to be the class name based on the
most recent version. If that name fails to load, then names
based on prior version will be attempted until one works, or a
ClassNotFoundException is returned. <p>

Once a class name algorithm is identified that successfully loads
a class, the nameUtil parameter is updated to reflect that
algorithm, and thus subsequent calls to this method should
specify a class name using the new algoritm. <p>

@param classLoader Application class loader to be used
@param className Name of the class to load
@param nameUtil Name Utility instance used to generate the
name of the generated class to load

@return the loaded class or null if the class name was null.

@throws ClassNotFoundException if a class by the specified
class name could not be loaded.