NutzCN Logo
问答 登录时 报错 org.nutz.http.HttpException: url=http://127.0.0.1/ 是怎么回事啊?
发布于 2225天前 作者 hongpeiGitHub 2598 次浏览 复制 上一个帖子 下一个帖子
标签:

org.nutz.http.HttpException: url=http://127.0.0.1/ifm/api
at org.nutz.http.sender.PostSender.send(PostSender.java:41)
at org.nutz.http.Http.post(Http.java:174)
at com.ism.dispcter.ApiDispcterImpl.doProcess(ApiDispcterImpl.java:23)
at com.ism.controller.LoginController.login(LoginController.java:78)
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.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:25)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
at com.ism.dispcter.SevFilter.doFilter(SevFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:496)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1156)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
at sun.net.www.http.HttpClient.(HttpClient.java:242)
at sun.net.www.http.HttpClient.New(HttpClient.java:339)
at sun.net.www.http.HttpClient.New(HttpClient.java:357)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1334)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1309)
at org.nutz.http.sender.PostSender.send(PostSender.java:32)
... 41 more
09:13:30,199 WARN org.nutz.mvc.impl.processor.FailProcessor:28 - Error@/login :

```

17 回复
com.ism.dispcter.ApiDispcterImpl.doProcess(ApiDispcterImpl.java:23)

这是你自己的Processor呢,发请求到某个地方的样子

这是org.nutz.http 下的Http.class 类

public static String post(String url, Map<String, Object> params, int timeout) {
        return Sender.create(Request.create(url, METHOD.POST, params, null))
                     .setTimeout(timeout)
                     .send()//为什么执行到这一步就会报异常呢?
                     .getContent();
    }

我不明白 http.post方法下的 send()是什么意思

发送请求的意思啊

我前面是这样写的 未能找到是什么原因引发的呢?
我该怎么处理啊

@Override
	public String doProcess(Map<String,Object> map) throws Exception {
		String params = gson.toJson(map);
		map.clear();
		map.put("json", URLEncoder.encode(params,"UTF-8"));
		String apiRet = Http.post(Constant.SERVER_ADDR, map, Constant.TIME_OUT);
		return apiRet;
	}

这代码不是你写的??? 你不知道这段代码的含义?

代码不是我写的呢,我找不出问题的嘛,所有来问下大牛是啥问题呢?

写代码的人跑啦!好吧 ,还是谢谢你们 。

这是把登录请求转发给另外一个http服务??

我觉得应该这个业务逻辑搞清楚

应该是滴

public class Constant {
	// 远程服务的地址
	public static String SERVER_ADDR = "";

	// 远程服务的地址
	public static String UPLOAD_ADDR = "";

	// 远程服务的地址
	public static String UPLOAD_WEBSITE = "";

	// 远程服务的地址
	public final static int TIME_OUT = 90000;

是这样的 我不了解http.post有什么用?百度说都被淘汰了 ,请问这个包到底有什么用呢?

Http.post淘汰? 你用的百度有毒

就是发个请求而已啊

你应该是去查/ifm/api是什么东西

来自炫酷的 NutzCN

谢谢 谢谢 万分感谢你的意见,

添加回复
请先登陆
回到顶部