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 21AD2200CCA for ; Wed, 19 Jul 2017 23:52:17 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1E5D716A00C; Wed, 19 Jul 2017 21:52:17 +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 3CF7316A009 for ; Wed, 19 Jul 2017 23:52:16 +0200 (CEST) Received: (qmail 9126 invoked by uid 500); 19 Jul 2017 21:52:15 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 9113 invoked by uid 99); 19 Jul 2017 21:52:13 -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, 19 Jul 2017 21:52:13 +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 3B99EC0350 for ; Wed, 19 Jul 2017 21:52:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.879 X-Spam-Level: * X-Spam-Status: No, score=1.879 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id Fi01cpg8j-2P for ; Wed, 19 Jul 2017 21:52:11 +0000 (UTC) Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id E08FE5FACE for ; Wed, 19 Jul 2017 21:52:10 +0000 (UTC) Received: by mail-wm0-f53.google.com with SMTP id l81so2890769wmg.1 for ; Wed, 19 Jul 2017 14:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=8meVxvUkaJ8bVT7nemIJkGdl50vlOuWRzaFvTS683yQ=; b=t/i9q+NgiV3v9KjnuPzvv8V+uJMI86UXIiMV6FeD/BkXmeKbZY1uAUAJGIaG0+fkL0 tc057toL5Faajl16SbwC6AX2Al8jk7uqOHwfsP3B8i8GwWz0znhBPfaShUG8VCMMaVoj 6DxJKzC5gOyZlYBVoPazCn5BmyNYZX/HFASzIE5QG6tWSu/EzeX5wSDjclLvaZUFd9yK gR7z8MIxPPSObxzTCbWGN2L9uaqG6XQ3ksJpe61f/6BCRggRY6wpSTDKez6xrIKlG/hY TE4HtRcuAKaMH/c/mooScO0NWWx/Ul/ffM+1uAY32HEmShHnPo5qskEucxZ7BsGRGChI b4/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=8meVxvUkaJ8bVT7nemIJkGdl50vlOuWRzaFvTS683yQ=; b=hx9uK/0ZVusWHpl0qwDTzDKoASmIFSO7wbOJ1eezLO4JLSZcw39PasksUAguiDTWmK JrT85NVqaiC7d5SbrjHwtBIB908SC4ZO+qWqrTisOazTqRgevVJGCF+kpQrJGkYuZImr VNHpMf7pivEasq6ZAWBuSDLRH97SxQ8gWykfbAcFHjaHVGCuZDkdvMsbh1YwF90PDlYe OknMgZlL5T6bV1hg5sT052eE0uBJbRBAxA50zF5qFE88gSx5Tp9ep2JOh+bF3WjN1jnM JoW9x56jJVDawUNx3ko+IjjDRb06QydaRwrjEGZy0bIoxEzTq6oT+r5xUCW4t1vjmpXk FeDg== X-Gm-Message-State: AIVw111UBdQd9qZyR1lbrw4FUfIPhia4Hhwy09uoX0oChyUKc6PD46nL SXLutZUTUeZsgEKuEz/0I7fbRuq6zg== X-Received: by 10.80.150.70 with SMTP id y64mr1081963eda.192.1500501130449; Wed, 19 Jul 2017 14:52:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.182.253 with HTTP; Wed, 19 Jul 2017 14:52:10 -0700 (PDT) In-Reply-To: <737169895.771698.1500498794750@mail.yahoo.com> References: <737169895.771698.1500498794750.ref@mail.yahoo.com> <737169895.771698.1500498794750@mail.yahoo.com> From: Ken McWilliams Date: Wed, 19 Jul 2017 15:52:10 -0600 Message-ID: Subject: Re: struts2 +rest service problem To: Struts Users Mailing List , john lee Content-Type: multipart/alternative; boundary="94eb2c195994dd97d40554b2a43c" archived-at: Wed, 19 Jul 2017 21:52:17 -0000 --94eb2c195994dd97d40554b2a43c Content-Type: text/plain; charset="UTF-8" As mentioned in the other thread have you added the conventions plug-in? The indicated error indicates a failure of Struts2 to be able to find what it needs so your posted source should not be at issue. On Wed, Jul 19, 2017 at 3:13 PM, john lee wrote: > > Please help for the struts2 + rest service > > http://beta-dev/ecommerce/employee.xml > > > > > return the following error report > > Struts Problem Report > Struts has detected an unhandled exception: > | Messages: | > - com.thoughtworks.xstream.XStream > - com/thoughtworks/xstream/XStream > - java.lang.reflect.InvocationTargetException > - java.lang.RuntimeException: java.lang.reflect. > InvocationTargetException > - java.lang.RuntimeException: java.lang.RuntimeException: > java.lang.reflect.InvocationTargetException > - java.lang.RuntimeException: java.lang.RuntimeException: > java.lang.RuntimeException: java.lang.reflect.InvocationTargetException > | > | File: | org/apache/catalina/loader/WebappClassLoader.java | > | Line number: | 1,714 | > > > Stacktraces > java.lang.RuntimeException: java.lang.RuntimeException: > java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException > com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject( > ContainerImpl.java:301) > com.opensymphony.xwork2.inject.ContainerImpl.inject( > ContainerImpl.java:492) > com.opensymphony.xwork2.inject.ContainerImpl$6.call( > ContainerImpl.java:530) > > > source code: > cat Employee*.java > package xyz; > import xyz.*; > import java.util.Map; > import org.apache.struts2.rest.DefaultHttpHeaders;import > org.apache.struts2.rest.HttpHeaders;import com.opensymphony.xwork2.ModelDriven;public > class EmployeeController implements ModelDriven{ private > static final long serialVersionUID = 1L; private String id; > private Object model; private EmployeeRepository employeeRepository > = new EmployeeRepository(); private static Map > map; { map = employeeRepository.findAllEmployee(); > } public HttpHeaders index() { model = map; > return new DefaultHttpHeaders("index").disableCaching(); > } public String add(){ Integer empId = > Integer.parseInt(id); Employee emp = new > Employee(empId,"Ramesh", "PQR"); model = emp; > return "SUCCESS"; } public String getId() { > return id; } public void setId(String id) { > model = employeeRepository.getEmployeeById(id); this.id = > id; } @Override public Object getModel() { > return model; }} > package xyz; > import java.util.*;import xyz.*; > > public class Employee { private Integer id; private String > name; private String company; public Employee(Integer id, > String name, String company){ this.id =id; > this.name = name; this.company = company; } > public Integer getId() { return id; } public > void setId(Integer id) { this.id = id; } > public String getName() { return name; } > public void setName(String name) { this.name = name; > } public String getCompany() { return company; > } public void setCompany(String company) { > this.company = company; }} package xyz; > > import java.util.*;import java.sql.Timestamp;import xyz.*; > import java.util.HashMap;import java.util.Map; > public class EmployeeRepository { private static > Map map = new HashMap(); public > EmployeeRepository(){ map.put("111", new Employee(111, > "Ram", "ABC")); map.put("222", new Employee(222, "Shyam", > "EFG")); map.put("333", new Employee(333, "Mohan", "XYZ")); > } public Employee getEmployeeById(String id){ > return map.get(id); } public Map > findAllEmployee(){ return map; }} > > my configuration for struts.xml > > > > > > > /> > > > > > > > > > > > > value="/rest:rest,:struts"/> > > > > > > value="rest-default"/> > > > > > > > -- Sent from my C64 using a 300 baud modem --94eb2c195994dd97d40554b2a43c--