Gradle throws:无法建立环回连接

时间:2015-06-16 12:20:52

标签: gradle

Gradle抛出异常消息"无法建立环回连接"。以下是控制台抛出的堆栈跟踪。

java.io.IOException: Unable to establish loopback connection                            
org.gradle.internal.UncheckedException: java.io.IOException: Unable to establish loopback connection                                                                   
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:39)                                                                         
        at org.gradle.messaging.remote.internal.inet.SocketConnection.<init>(SocketConnection.java:58)                                                   
        at org.gradle.messaging.remote.internal.inet.SocketConnectCompletion.create(SocketConnectCompletion.java:43)                                                 
        at org.gradle.messaging.remote.internal.hub.MessageHubBackedObjectConnection.connect(MessageHubBackedObjectConnection.java:92)                               
        at org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor.forkProcess(ForkingTestClassProcessor.java:78)                                     
        at org.gradle.api.internal.tasks.testing.worker.ForkingTestClassProcessor.processTestClass(ForkingTestClassProcessor.java:56)                                
        at org.gradle.api.internal.tasks.testing.processors.RestartEveryNTestClassProcessor.processTestClass(RestartEveryNTestClassProcessor.java:45)                
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)                  
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)                                                                     
        at java.lang.reflect.Method.invoke(Method.java:606)                             
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)                                                                     
        at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)                                                                     
        at org.gradle.messaging.dispatch.FailureHandlingDispatch.dispatch(FailureHandlingDispatch.java:29)                                                           
        at org.gradle.messaging.dispatch.AsyncDispatch.dispatchMessages(AsyncDispatch.java:132)                                                                      
        at org.gradle.messaging.dispatch.AsyncDispatch.access$000(AsyncDispatch.java:33)
        at org.gradle.messaging.dispatch.AsyncDispatch$1.run(AsyncDispatch.java:72)     
        at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)                                         
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)                                                                           
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)                                                                           
        at java.lang.Thread.run(Thread.java:744)

Gradle版本:

Gradle 1.12

建造时间:2014-04-29 09:24:31 UTC
内部编号:无
修订:a831fa866d46cbee94e61a09af15f9dd95987421

Groovy:1.8.6
Ant:2013年12月23日编译的Apache Ant(TM)版本1.9.3 常春藤:2.2.0
JVM:1.7.0_45(Oracle Corporation 24.45-b08)
操作系统:Windows 7 6.1 x86

Jdk是1.7.45。

有任何帮助吗?假设连接被AV终止,我试图阻止反病毒。但是,当AV关闭时,问题再次发生。

2 个答案:

答案 0 :(得分:0)

我认为这是Gradle无法连接到gradle守护程序的问题。您的机器可能存在网络配置问题,需要解决。

可能的解决方法是使用- (IBAction)subirImagen:(id)sender { NSData *imageData = UIImagePNGRepresentation(self.imagen.image); NSString *urlString = @"https://secure101.prositehosting.co.uk/php-upload-file-server-master2/subir.php"; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request setURL:[NSURL URLWithString:urlString]]; [request setHTTPMethod:@"POST"]; NSString *boundary = @"---------------------------14737809831466499882746641449"; NSString *contentType = [NSString stringWithFormat:@"multipart/form-data; boundary=%@",boundary]; [request addValue:contentType forHTTPHeaderField: @"Content-Type"]; NSMutableData *body = [NSMutableData data]; [body initMultipart]; [body addPart:@"myFile" withFileName:@"imagen.png" withNSData:imageData]; [body addPart:@"myName" withValue:@"Ricardo"]; [body writeLastBoundary]; [request setHTTPBody:body]; NSURLResponse* response = nil; NSError* err = nil; NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err]; NSHTTPURLResponse *HTTPURLResponse = (NSHTTPURLResponse *)response; NSInteger statusCode = [HTTPURLResponse statusCode]; NSString* mensaje = [NSString stringWithFormat:@"Request: %ld",(long)statusCode]; UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Server" message:mensaje delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil]; [myAlertView show]; NSLog(@"Response Meta: %@", response); NSLog(@"String sent from server %@",[[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]); //As was advised NSHTTPURLResponse* newResp = (NSHTTPURLResponse*)response; //crash here NSLog(@"%ld", (long)newResp.statusCode); } 选项在没有守护程序的情况下运行。如果仍然不起作用,还有其他原因导致它尝试建立连接,可能是由于自定义插件或构建脚本。

答案 1 :(得分:0)

我使用的是JDK v1.7.0_45,现在我使用1.7.0_79。自升级以来,我没有观察到这个问题。今天早上我回到了v1.7.0_45,我已经注意到了#34;无法建立环回连接&#34;六次迭代中的两次。