You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2007/05/24 16:17:16 UTC

[jira] Commented: (COCOON-2068) Add failover for loading classes.

    [ https://issues.apache.org/jira/browse/COCOON-2068?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12498650 ] 

Carsten Ziegeler commented on COCOON-2068:
------------------------------------------

In some scenarios Cocoon uses its own class loader, that's why the context class loader is used. And for exactly this reason it must be used first.

Now usually the class loader set as the context class loader has the default class loader (or the webapp class loader) as parent.
So if your class in on the usual class path, it should be found anyway.

Can you give more information about your problem/environment etc.?


> Add failover for loading classes.
> ---------------------------------
>
>                 Key: COCOON-2068
>                 URL: https://issues.apache.org/jira/browse/COCOON-2068
>             Project: Cocoon
>          Issue Type: Improvement
>          Components: * Cocoon Core
>    Affects Versions: 2.1.10
>            Reporter: solprovider
>            Priority: Minor
>
> The ClassLoader from currentThread.getContextClassLoader() was unable to retrieve classes in my environment.  Add fallback to standard Java class loading.
> NOTE: The two "set" lines work in either order.  I prefer trying standard methods before using custom code, but Cocoon may be reasons for using custom code.
> public class ClassUtils{
>    public static Class loadClass(String className) throws ClassNotFoundException{
>       Class ret;
>       try{
>          ret= Class.forName(className);
>       }catch(ClassNotFoundException e){
>          ret= ClassUtils.getClassLoader().loadClass(className);
>       }
>       return ret;
>    }
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.