เมื่อ Java จำลองคำขอ HTTP ข้อผิดพลาดรหัสและรายละเอียดข้อผิดพลาดจะถูกรายงานดังนี้:
configuration.xml
<? xml version = "1.0" การเข้ารหัส = "utf-8"?> <ystem> <!-ขอ url-> <category name = "url" คำอธิบาย = "ตัวบ่งชี้ URL การกำหนดค่าที่เกี่ยวข้อง"> <item name = "volumenormurl" value = "10.150.33.154:8080/getinfo/get
รหัส Java
string url = configuration.getString ("url.volumenormurl"); ลอง {log.info ("====================== {}", url); การตอบสนองสตริง = httputil.doget (url); log.info ("crmloginurl responsestring {} {}", url, responsestring); return jsonResponse.success (); } catch (wxException e) {log.error ("crmlogin ล้มเหลว ... {}, e = {}", e.getMessage (), e); E.PrintStackTrace (); return jsonResponse.failure ("ล้มเหลว"); -รหัสข้อผิดพลาด:
java.lang.illegalargumentexception: ตัวละครที่ผิดกฎหมายในชื่อโครงการที่ดัชนี 0: 10.150.33.154:8080/getinfo/getuserat java.net.uri.create (uri.java:852) ที่ org.apache.http.client.metht ที่ com.foundersc.ifc.service.base.http.httputil.doget (httputil.java:30) ที่ com.foundersc.ifc.volumenorm.controller.test.getNorm (test.java:29) sun.reflect.nativemethodaccessorimpl.invoke (nativemethodaccessorimpl.java:62) ที่ sun.reflect.delegatingmethodaccessorimpl.invoke (มอบหมาย Methodaccessorimpl.java:43) org.springframework.web.method.support.invocablehandlermethod.invoke (invocablehandlermethod.java:215) ที่ org.springframework.web.method.support.invocablehandlermethod.invoke org.springframework.web.servlet.mvc.method.annotation.servletinvocablehandlermethod.invokeandhandle org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.invokehandlemethod (requestmappinghandleradapter.java:781) ที่ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.handleinternal (requestmappinghandleradapter.java:721) ที่ org.springframework.web.servlet.mvc.method.abstracthandlermethodadapter.handle (abstracthandlermethodadapter.java:83) ที่ org.springframework.web.servlet.Dispatchersert org.springframework.web.servlet.dispatcherservlet.doservice (dispatcherservlet.java:877) ที่ org.springframework.web.servlet.frameworkservlet.processrequest org.springframework.web.servlet.frameworkservlet.doget (frameworkservlet.java:857) ที่ javax.servlet.http.httpservlet.service org.springframework.web.servlet.frameworkservlet.service (frameworkservlet.java:842) ที่ javax.servlet.http.httpservlet.service (httpservlet.java:820) ที่ org.mortbay.jetty.servlet.servletholder.handle (servletholder.java:511) ที่ org.mortbay.jetty.servlet.servlethandler $ cachedchain.dofilter (Servlethandler.java:1166 org.springframework.web.filter.characterencodingfilter.dofilterinternal (ตัวละคร java.java:88) ที่ org.springframework.web.filter.onceperrequestfilter.dofilter org.mortbay.jetty.servlet.servlethandler $ cachedchain.dofilter (servlethandler.java:1157) ที่ org.mortbay.jetty.servlet.servlethandler.handle org.mortbay.jetty.security.securityhandler.handle (Securityhandler.java:216) ที่ org.mortbay.jetty.servlet.sessionhandler.handle (sessionhandler.java:182) ที่ org.mortbay.jetty.handler.handler.handler. org.mortbay.jetty.webapp.webappcontext.handle (webappcontext.java:418) ที่ org.mortbay.jetty.handler.contexthandlercollection.handle (contexthandlercollection.java:230) ที่ org.mortbay.jetty.handler.handlercollection.handle (handlercollection.java:114) ที่ org.mortbay.jetty.handler.handlerwrapper.handle (handlerwrapper.java:152) ที่ org.mortbay.jetty. org.mortbay.jetty.httpconnection.handlerequest (httpconnection.java:542) ที่ org.mortbay.jetty.httpconnection $ requesthandler.headercomplete (httpconnection.java:923) org.mortbay.jetty.httpparser.parsenext (httpparser.java:547) ที่ org.mortbay.jetty.httpparser.parseavailable (httpparser.java:212) ที่ org.mortbay.jetty.httpconnection.handle (httpconnection.java:404) ที่ org.mortbay.io.nio.selectchannelendpoint.run (selectchannelendpoint.java:409) ที่ org.mortbay.thread.queuedthreadpool $ poolthread.run (queuedthreadpool.java:582) เกิดจาก: java.net.urisyntaxexception: ตัวละครที่ผิดกฎหมายในชื่อโครงการที่ดัชนี 0: 10.150.33.154 java.net.uri $ parser.fail (uri.java:2848) ที่ java.net.uri $ parser.checkchars (uri.java:3021) ที่ java.net.uri $ parser.checkchar (uri.java:3031) java.net.uri $ parser.parse (uri.java:3047) ที่ java.net.uri. <init> (uri.java:588) ที่ java.net.uri.create (uri.java:850) 'Socket'Process เสร็จสิ้นด้วยรหัสออก -1
ฉันค้นหา Baidu และพบบทความที่ไร้ประโยชน์มากมาย ต่อมาฉันค้นหา Bing และพบสาเหตุของราก ฉันต้อง http: // ต่อหน้าค่าใน configuration.xml มิฉะนั้นฉันจะรายงานข้อผิดพลาด ~ ทุกคนยอมแพ้ Baidu ซึ่งถูกหลอกลวงเกินไป