Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8679C2004F1 for ; Wed, 30 Aug 2017 08:42:06 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 84EAB16876E; Wed, 30 Aug 2017 06:42:06 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id CAD24168768 for ; Wed, 30 Aug 2017 08:42:05 +0200 (CEST) Received: (qmail 18387 invoked by uid 500); 30 Aug 2017 06:42:04 -0000 Mailing-List: contact issues-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list issues@struts.apache.org Received: (qmail 18371 invoked by uid 99); 30 Aug 2017 06:42:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Aug 2017 06:42:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 73F47C312C for ; Wed, 30 Aug 2017 06:42:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id 4OVK4rQUi311 for ; Wed, 30 Aug 2017 06:42:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 6FBB161263 for ; Wed, 30 Aug 2017 06:42:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 85DD3E0D49 for ; Wed, 30 Aug 2017 06:42:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id AA89E2416F for ; Wed, 30 Aug 2017 06:42:00 +0000 (UTC) Date: Wed, 30 Aug 2017 06:42:00 +0000 (UTC) From: "Yasser Zamani (JIRA)" To: issues@struts.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (WW-4846) Not able to convert Spring object to the JSON response MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Wed, 30 Aug 2017 06:42:06 -0000 [ https://issues.apache.org/jira/browse/WW-4846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16146715#comment-16146715 ] Yasser Zamani commented on WW-4846: ----------------------------------- You're welcome and thanks a lot for reporting! > 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.13 > Reporter: Vijay Srivastava > Priority: Blocker > > 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 > 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. > Any idea what's wrong here ? I am using Java 1.8. I think below code in JSONWriter is not working as expected > 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; > } -- This message was sent by Atlassian JIRA (v6.4.14#64029)