cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "solprovider (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COCOON-2068) Add failover for loading classes.
Date Thu, 24 May 2007 14:25:16 GMT

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

solprovider updated COCOON-2068:
--------------------------------

    Description: 
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 would work in either order.  I believe Cocoon is using a custom
ClassLoader to dynamically load changes so the custom method must be tried first.  (The auto-reload
ability will be lost for environments using the fallback, but at least they will be able to
use Cocoon.)

public class ClassUtils{
   public static Class loadClass(String className) throws ClassNotFoundException{
      Class ret;
      try{
         ret= ClassUtils.getClassLoader().loadClass(className);
      }catch(ClassNotFoundException e){
          ret= Class.forName(className);
     }
      return ret;
   }
}

  was:
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;
   }
}


Realized why custom class loader is needed.

> 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 would work in either order.  I believe Cocoon is using a custom
ClassLoader to dynamically load changes so the custom method must be tried first.  (The auto-reload
ability will be lost for environments using the fallback, but at least they will be able to
use Cocoon.)
> public class ClassUtils{
>    public static Class loadClass(String className) throws ClassNotFoundException{
>       Class ret;
>       try{
>          ret= ClassUtils.getClassLoader().loadClass(className);
>       }catch(ClassNotFoundException e){
>           ret= Class.forName(className);
>      }
>       return ret;
>    }
> }

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


Mime
View raw message