Quando o Java simula a solicitação HTTP, um erro, código e detalhes de erro são relatados da seguinte forma:
Configuration.xml
<? xml versão = "1.0" coding = "utf-8"?> <system> <!-solicitar url-> <category name = "url" descrição = "URL do indicador Relacionado Configuração"> <names itens <gumenormurl "Value =" 10.150.3.154:8080/GETINFO/GETUSERS "
Código Java
String url = configuration.getString ("url.volumenormurl"); tente {log.info ("==================== {}", url); String ResponsEstring = httputil.Doget (URL); log.info ("CrmLoginurl ResponsEstring {} {}", url, responseString); retornar jsonResponse.success (); } catch (wxException e) {Log.error ("Crmlogin falha ... {}, e = {}", e.getMessage (), e); E.PrintStackTrace (); retornar jsonResponse.failure ("Fail"); }Código de erro:
java.lang.illegalargumentException: caráter ilegal em nome do esquema no índice 0: 10.150.33.154:8080/getinfo/getUserat java.net.uri.create (uri.java:852) at org.apache.http.crike.methods.ht. com.foundersc.ifc.service.base.http.httputil.doget (httputil.java:30) em com.foundersc.ifc.volumenorm.controller.test.getNorm (test.java:29) em sun.refleclect.NATMETEMODCACCACKFACKFACLECMORM.Java:29) sun.reflelect.nativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:62) em sun.reflelect.delegatingMethodaccessorimpl.invake (delegatingMethodaccessorImpl.java:43) em java.lang.reflectMethMethMethMetM. org.springframework.web.method.support.invocableHandlermethod.invoke (InvocableHandlermethod.java:215) em org.springframework.web.method.suptort.invochandlermethod.invokeb.method.suptort.InvocHandormethandod.invokeb. org.springframework.web.servlet.mvc.method.annotation.servletinvocableHandlermethod.invokeandHandle (servletInvocableHandlermethod.java:104) em org.springframework.web.servlet.mvc.method.annotation.requestMappingHandLapter.invokeHandleMethod (requestmapphandleRadapter.java:781) em org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.handleinternal (requestmapphandleRadapter.java:721) em org.springframework.web.servlet.mvc.method.abstracthandlermethodadapter.handle (abstracthandlermethodAdapter.java:83) em org.springframework.web.servlet.daisatcherservt.dispatch (desatchingframework.web.servlet.daistletlet.dispatch (DispathersTching.web.web.servlet.daisatcherSlet.dispatch (DispathersTching.Web.Web.Servlet.DaisatcherSlet.dispatch org.springframework.web.servlet.dispatcherservlet.doservice (despachoServlet.java:877) em org.springframework.web.servlet.frameworkservlet.processRequest (estrutura org.springframework.web.servlet.frameworkservlet.doget (estrutura org.springframework.web.servlet.frameworkservlet.service (estrutura org.mortbay.jetty.servlet.servletholder.handle (servLetholder.java:511) em org.mortbay.jetty.servlet.servlethandler $ Cachedchain.dofilter (servlethandler.java:1166) em org.springframework.web.filter.characterencodingFilter.dofilterinternal (caracterencodingfilter.java:88) em org.springframework.web.filter.oncéperrequestilter.dofilter (uma vezperequestfilter.Java.Java.Java.Java: org.mortbay.jetty.servlet.servlethandler $ CACHEDCHAIN.dofilter (servlethandler.java:1157) em org.mortbay.Jetty.Servlet.ServleThandler.Handle (ServLethandler.java:388) org.mortbay.Jetty.Security.SecurityHandler.Handle (SecurityHandler.java:216) em org.mortbay.jetty.servlet.sessionhandler.Handtyle (SessionHandler.java:182) at org.mortbay.jetty.Handty.Contexthandler.Java:182) at org.mortbay.jetty.hetty.JOntexthler.java:182) at org.mortbay.jetty.tty.jandler.java: org.mortbay.jetty.webapp.webappcontext.handle (webAppContext.java:418) em org.mortbay.jetty.handler.contexthandlerCollection.handle (contextHandlercollection.java:230) em org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.httpconnection.handlerequest (httpconnection.java:542) em org.mortbay.jetty.httpconnection $ requesthandler.headercomplete (httpconection.java:923) em org.mortbay.jetty.httpparser.parsenext (httpparser.java:547) em org.mortbay.jetty.httpparser.parseAvAcable (httpparser.java:212) em org.mortbay.jetty.httpconnection.handle (httpconnection.java:404) em org.mortbay.io.nio.selectChannelendPoint.run (selectChannelendPoint.java:409) em org.mortbay.thread.queedthreadpool $ poolthread.run (fileuedthreadpool.java:582) causado por: java.net.urisyntoxexception: caráter ilegal em nome do esquema no índice 0: 10.150.33.154:8080/GeGeNfo/getUserat java.net.uri $ parser.fail (uri.java:2848) em java.net.uri $ parser.checkchars (uri.java:3021) em java.net.uri $ parser.checkchar (uri.java:3031) java.net.uri $ parser.parse (uri.java:3047) em java.net.uri. 'Socket'process terminou com o código de saída -1
Eu procurei no Baidu e encontrei muitos artigos inúteis. Mais tarde, procurei no Bing e encontrei a causa raiz. Devo http: // na frente do valor em Configuration.xml, caso contrário, relatarei um erro ~ Todo mundo desistiu do Baidu, que é muito enganado.