[ https://issues.apache.org/jira/browse/WW-4846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16239612#comment-16239612 ]
Hudson commented on WW-4846: ---------------------------- SUCCESS: Integrated in Jenkins build Struts-master-JDK7 #50 (See [https://builds.apache.org/job/Struts-master-JDK7/50/]) WW-4846 Adds unit tests (yasser.zamani: rev 92502510df5ed98267208396f0bbaa8cb67dd802) * (edit) plugins/json/src/test/java/org/apache/struts2/json/JSONResultTest.java WW-4846 Fixes unit tests for JDK8 (yasser.zamani: rev fb0a6120db58ba33d331816444be2908295d82a2) * (edit) plugins/json/src/test/java/org/apache/struts2/json/JSONResultTest.java > Not able to convert Spring object to the JSON response > ------------------------------------------------------ > > Key: WW-4846 > URL: https://issues.apache.org/jira/browse/WW-4846 > Project: Struts 2 > Issue Type: Bug > Components: Core Results, Plugin - JSON > Affects Versions: 2.5.12 > Reporter: Vijay Srivastava > Priority: Blocker > Fix For: 2.5.14 > > > Hi, > I am using latest version of struts struts-2.5.12 and and spring 4.1 as > advised. I am having an issue in JSON response. There is an action class > which is returning Spring request scoped object as JSON response however I am > getting error as below > {noformat} > ERROR ExceptionMappingInterceptor org.apache.struts2.json.JSONException: > org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: > org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: > java.lang.reflect.InvocationTargetException > org.apache.struts2.json.JSONException: > org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: > org.apache.struts2.json.JSONException: org.apache.struts2.json.JSONException: > org.apache.struts2.json.JSONException: > java.lang.reflect.InvocationTargetException > at org.apache.struts2.json.JSONWriter.bean(JSONWriter.java:269) > at org.apache.struts2.json.JSONWriter.processCustom(JSONWriter.java:197) > at org.apache.struts2.json.JSONWriter.process(JSONWriter.java:182) > at org.apache.struts2.json.JSONWriter.value(JSONWriter.java:143) > at org. > {noformat} > Any idea what's wrong here ? I am using Java 1.8. I think below code in > JSONWriter is not working as expected > {code:java} > protected Method findBaseAccessor(Class clazz, Method accessor) { > Method baseAccessor = null; > if (clazz.getName().contains("$$EnhancerByCGLIB$$")) { > try { > baseAccessor = > Thread.currentThread().getContextClassLoader().loadClass( > clazz.getName().substring(0, > clazz.getName().indexOf("$$"))).getMethod( > accessor.getName(), accessor.getParameterTypes()); > } catch (Exception ex) { > LOG.debug(ex.getMessage(), ex); > } > } else if (clazz.getName().contains("$$_javassist")) { > try { > baseAccessor = Class.forName( > clazz.getName().substring(0, > clazz.getName().indexOf("_$$"))) > .getMethod(accessor.getName(), > accessor.getParameterTypes()); > } catch (Exception ex) { > LOG.debug(ex.getMessage(), ex); > } > > //in hibernate4.3.7,because javassist3.18.1's class name generate > rule is '_$$_jvst'+... > } else if(clazz.getName().contains("$$_jvst")){ > try { > baseAccessor = Class.forName( > clazz.getName().substring(0, > clazz.getName().indexOf("_$$"))) > .getMethod(accessor.getName(), > accessor.getParameterTypes()); > } catch (Exception ex) { > LOG.debug(ex.getMessage(), ex); > } > } > else { > return accessor; > } > return baseAccessor; > } > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029)