자바 시 뮬 레이 션 http 요청 오류 정리

5783 단어 자바http 요청
자바 시 뮬 레이 션 http 요청 시 오류,코드,오류 상세 정 보 는 다음 과 같 습 니 다.
Configuration.xml

<?xml version="1.0" encoding="UTF-8"?>
<system>
  <!--  url-->
  <category name="url" description="   URL    ">
    <item name="volumenormUrl" value="10.150.33.154:8080/getInfo/getUser" description="   URL  "></item>
  </category>
</system>
Java code

 String url = Configuration.getString("url.volumenormUrl");
    try {
      log.info("=============={}",url);
      String responseString = HttpUtil.doGet(url);
      log.info("crmLoginUrl responseString {} {}", url, responseString);
      return JsonResponse.success();
    } catch (WXException e) {
      log.error("crmLogin fail... {}, e = {} ", e.getMessage(), e);
      e.printStackTrace();
      return JsonResponse.failure("fail");
    }
오류 코드:

java.lang.IllegalArgumentException: Illegal character in scheme name at index 0: 10.150.33.154:8080/getInfo/getUser
	at java.net.URI.create(URI.java:852)
	at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
	at com.foundersc.ifc.service.base.http.HttpUtil.doGet(HttpUtil.java:30)
	at com.foundersc.ifc.volumenorm.controller.Test.getNorm(Test.java:29)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215)
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:781)
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:721)
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at 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)
	at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: java.net.URISyntaxException: Illegal character in scheme name at index 0: 10.150.33.154:8080/getInfo/getUser
	at java.net.URI$Parser.fail(URI.java:2848)
	at java.net.URI$Parser.checkChars(URI.java:3021)
	at java.net.URI$Parser.checkChar(URI.java:3031)
	at java.net.URI$Parser.parse(URI.java:3047)
	at java.net.URI.<init>(URI.java:588)
	at java.net.URI.create(URI.java:850)
	... 41 more
Disconnected from the target VM, address: '127.0.0.1:65013', transport: 'socket'

Process finished with exit code -1
바 이 두 가 살 펴 보 니 쓸데없는 글 이 많 았 습 니 다.나중에 bing 에 올 라 가서 근원 을 찾 았 습 니 다.configuration.xml 에 있 는 value 앞 에 반드시 http://가 있어 야 합 니 다.그렇지 않 으 면 잘못 보고 할 것 입 니 다.여러분 바 이 두 를 포기 하 세 요.너무 구덩이 입 니 다.

좋은 웹페이지 즐겨찾기