Hi Johannes,

I don't know it would be the right approach, but what about using
ClassLoaderUtil#loadClass [1]?


[1] 
http://svn.apache.org/viewvc/struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/util/ClassLoaderUtil.java?view=markup

Maurizio Cucchiara



On 25 August 2011 18:30,  <[email protected]> wrote:
> Author: jogep
> Date: Thu Aug 25 16:30:49 2011
> New Revision: 1161630
>
> URL: http://svn.apache.org/viewvc?rev=1161630&view=rev
> Log:
> WW-3670: JSONWriter cannot load CGLIB classes if its JAR is in SharedLib
> Patch provided by Bruno Borges
>
> Modified:
>    
> struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java
>
> Modified: 
> struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java
> URL: 
> http://svn.apache.org/viewvc/struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java?rev=1161630&r1=1161629&r2=1161630&view=diff
> ==============================================================================
> --- 
> struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java
>  (original)
> +++ 
> struts/struts2/trunk/plugins/json/src/main/java/org/apache/struts2/json/JSONWriter.java
>  Thu Aug 25 16:30:49 2011
> @@ -255,7 +255,7 @@ class JSONWriter {
>         Method baseAccessor = null;
>         if (clazz.getName().indexOf("$$EnhancerByCGLIB$$") > -1) {
>             try {
> -                baseAccessor = Class.forName(
> +                baseAccessor = 
> Thread.currentThread().getContextClassLoader().loadClass(
>                         clazz.getName().substring(0, 
> clazz.getName().indexOf("$$"))).getMethod(
>                         accessor.getName(), accessor.getParameterTypes());
>             } catch (Exception ex) {
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to