Package org.jpox.exceptions

Examples of org.jpox.exceptions.ClassNotResolvedException


        {
            return registry.loadClass(pluginId, className);
        }
        catch(ClassNotFoundException ex)
        {
            throw new ClassNotResolvedException(ex.getMessage(),ex);
        }
    }
View Full Code Here


    {
        if (name == null)
        {
            // Avoid the NPE and just throw a "not resolved"
            String msg = LOCALISER.msg("001000", name);
            throw new ClassNotResolvedException(msg);
        }
        if (name.equals(ClassNameConstants.BYTE))
        {
            return byte.class;
        }
        else if (name.equals(ClassNameConstants.CHAR))
        {
            return char.class;
        }
        else if (name.equals(ClassNameConstants.INT))
        {
            return int.class;
        }
        else if (name.equals(ClassNameConstants.LONG))
        {
            return long.class;
        }
        else if (name.equals(ClassNameConstants.DOUBLE))
        {
            return double.class;
        }
        else if (name.equals(ClassNameConstants.FLOAT))
        {
            return float.class;
        }
        else if (name.equals(ClassNameConstants.SHORT))
        {
            return short.class;
        }
        else if (name.equals(ClassNameConstants.BOOLEAN))
        {
            return boolean.class;
        }
        else if (name.equals(ClassNameConstants.JAVA_LANG_STRING))
        {
            return String.class;
        }

        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        String cacheKey = newCacheKey(name, primary, contextClassLoader);
        //lookup in loaded and unloaded classes cache
        Class cls = (Class) loadedClasses.get(cacheKey);

        if (cls != null)
        {
            return cls;
        }

        cls = (Class) unloadedClasses.get(cacheKey);

        if (cls != null)
        {
            return cls;
        }

        // Try the supplied loader first
        if (cls == null)
        {
            cls = classOrNull(name, primary);
        }

        // Try the primary for this current thread
        if (cls == null && this.primary.get() != null)
        {
            cls = classOrNull(name, (ClassLoader) this.primary.get());
        }

        // Try the loader for the current thread
        if (cls == null)
        {
            cls = classOrNull(name, contextClassLoader);
        }

        // Try the loader for the PM context
        if (cls == null)
        {
            cls = classOrNull(name, pmContextLoader);
        }

        // Try the registered loader for runtime created classes
        if (cls == null && registeredLoader != null)
        {
            cls = classOrNull(name, registeredLoader);
        }

        // Try the user registered loader for classes
        if (cls == null && userRegisteredLoader != null)
        {
            cls = classOrNull(name, userRegisteredLoader);
        }

        if (cls == null)
        {
            if (JPOXLogger.CLASSLOADING.isDebugEnabled())
            {
                // Log the class loading failure in case its of use in debugging
                if (JavaUtils.isJRE1_4OrAbove())
                {
                    StackTraceElement[] traceElements = new Exception().getStackTrace();
                    StackTraceElement element = null;
                    int i = 0;
                    boolean processingClassLoaderResolverCalls = false;
                    while (element == null)
                    {
                        if (processingClassLoaderResolverCalls &&
                            traceElements[i].getClassName().indexOf(this.getClass().getName()) < 0)
                        {
                            // Next class in the stack trace after the JDOClassLoaderResolver calls
                            element = traceElements[i];
                        }
                        else if (traceElements[i].getClassName().startsWith("org.jpox"))
                        {
                            processingClassLoaderResolverCalls = true;
                        }
                        i++;
                    }
                    // Dont give stack trace, just the method that asked for class-resolving
                    JPOXLogger.CLASSLOADING.debug(LOCALISER.msg("001004", name,
                        element.getClassName() + "." + element.getMethodName(), "" + element.getLineNumber()));
                }
                else
                {
                    JPOXLogger.CLASSLOADING.debug(LOCALISER.msg("001005", name));
                }
            }
            String msg = LOCALISER.msg("001000", name);
            throw new ClassNotResolvedException(msg);
        }

        //put in unloaded cache, since it was not loaded here
        unloadedClasses.put(cacheKey, cls);
View Full Code Here

    {
        if (name == null)
        {
            // Avoid the NPE and just throw a "not resolved"
            String msg = LOCALISER.msg("001000", name);
            throw new ClassNotResolvedException(msg);
        }
        if (name.equals(ClassNameConstants.BYTE))
        {
            return byte.class;
        }
        else if (name.equals(ClassNameConstants.CHAR))
        {
            return char.class;
        }
        else if (name.equals(ClassNameConstants.INT))
        {
            return int.class;
        }
        else if (name.equals(ClassNameConstants.LONG))
        {
            return long.class;
        }
        else if (name.equals(ClassNameConstants.DOUBLE))
        {
            return double.class;
        }
        else if (name.equals(ClassNameConstants.FLOAT))
        {
            return float.class;
        }
        else if (name.equals(ClassNameConstants.SHORT))
        {
            return short.class;
        }
        else if (name.equals(ClassNameConstants.BOOLEAN))
        {
            return boolean.class;
        }
        else if (name.equals(ClassNameConstants.JAVA_LANG_STRING))
        {
            return String.class;
        }

        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
        String cacheKey = newCacheKey(name, primary, contextClassLoader);
        //only lookup in loaded classes cache
        Class cls = (Class) loadedClasses.get(cacheKey);

        if (cls != null)
        {
            return cls;
        }

        // Try the supplied loader first
        if (cls == null)
        {
            cls = ClassOrNullWithInitialize(name, primary);
        }

        // Try the primary for this current thread
        if (cls == null && this.primary.get() != null)
        {
            cls = ClassOrNullWithInitialize(name, (ClassLoader) this.primary.get());
        }

        // Try the loader for the current thread
        if (cls == null)
        {
            cls = ClassOrNullWithInitialize(name, contextClassLoader);
        }

        // Try the loader for the PM context
        if (cls == null)
        {
            cls = ClassOrNullWithInitialize(name, pmContextLoader);
        }

        // Try the registered loader for runtime created classes
        if (cls == null && registeredLoader != null)
        {
            cls = ClassOrNullWithInitialize(name, registeredLoader);
        }

        if (cls == null)
        {
            String msg = LOCALISER.msg("001000", name);
            throw new ClassNotResolvedException(msg);
        }
        loadedClasses.put(cacheKey, cls);

        return cls;
    }
View Full Code Here

                    }
                }

                if (c == null)
                {
                    throw new ClassNotResolvedException(classDecl);
                }
               
                JPOXLogger.GENERAL.info(LOCALISER.msg("021010",classDecl, c.getName()));

                // Give warning that the performance could have been improved by explicit usage
View Full Code Here

TOP

Related Classes of org.jpox.exceptions.ClassNotResolvedException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.