Solution to the org. apache. catalina. core. StandardWrapperValve invoke error in JSONArray (). fromObject (); standardwrappervalve

Source: Internet
Author: User

Solution to the org. apache. catalina. core. StandardWrapperValve invoke error in JSONArray (). fromObject (); standardwrappervalve

Servlet:

1 public void service (HttpServletRequest request, HttpServletResponse response) 2 throws ServletException, IOException {3 4 response. setContentType ("text/html"); 5 response. setCharacterEncoding ("UTF-8"); 6 7 IBllFrame interfaceOfBllFrame = new BllFrame (); 8 JSONArray json = null; 9 10 List <HashMap <String, Object> result = interfaceOfBllFrame. getStationPlace (); 11 System. out. println ("GetStationPlace:" + result. get (1 ). toString (); 12 try {13 System. out. println ("haha begin:" + json); 14 15 json = newJSONArray (). fromObject(Result );// The above error occurs in this sentence16 System. out. println ("haha success:" + json); 17} 18 catch (Exception e) {19 e. printStackTrace (); 20} 21 22 System. out. println ("Servlet --- StationPlace" + json); 23 PrintWriter out = response. getWriter (); 24 out. println (json); 25 out. flush (); 26 out. close (); 27}

The output result in the controller is as follows:

The following is the information:

GetStationPlace: {StationId = 10002, Stationlon = 29.90592, Stationlat = 121.525976}
Haha begin: null
February 29 10:37:46 AMOrg. apache. catalina. core. StandardWrapperValve invoke
Severe: Servlet. service () for servlet [GetStationPlaceServlet] in context with path [/BicycleDataSystem] threw exception [Servlet execution threw an exception] with root cause
Java. lang. ClassNotFoundException: net. sf. json. JSONArray
At org. apache. catalina. loader. WebappClassLoader. loadClass (WebappClassLoader. java: 1722)
At org. apache. catalina. loader. WebappClassLoader. loadClass (WebappClassLoader. java: 1573)

 

The original commons-beanutils.jar, commons-collections.jar, commons-lang.jar, commons-logging.jar, ezmorph. jar, json-lib.jar package in lib-"json folder is as follows:

Later commons-beanutils.jar, commons-collections.jar, commons-lang.jar, commons-logging.jar, ezmorph. jar, json-lib.jar put directly under the lib folder, as follows:

Note: that is to say commons-beanutils.jar, commons-collections.jar, commons-lang.jar, commons-logging.jar, ezmorph. jar, json-lib.jar these packagesBe sure to directly put it in the lib folderOtherwiseOrg. apache. catalina. core. StandardWrapperValve invokeError.

JSONArray (). fromObject requires the following jar package:Commons-beanutils.jar, commons-collections.jar, commons-lang.jar, commons-logging.jar, ezmorph. jar, json-lib.jar

: Http://pan.baidu.com/s/1pJUmBQN

References: http://greenboy1.iteye.com/blog/1046125

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.