https://kotlinlang.org logo
#spring
Title
# spring
g

George

07/17/2022, 12:34 PM
hi guys, i am getting
Copy code
finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80
org.springframework.web.reactive.function.client.WebClientRequestException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80; nested exception is io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /[0:0:0:0:0:0:0:1]:80
from a rather simple springboot-kotlin code. Has anyone encountered this? Thanks in advance 🙂
Repo: Controller:
Copy code
@SpringBootApplication
class SpringVarPathIssueApplication

fun main(args: Array<String>) {
    runApplication<SpringVarPathIssueApplication>(*args)
}

@RestController
class SimpleRestReactiveController {

    @GetMapping("/get")
    suspend fun getMapping(): String {
        return "todo"
    }

}
Test:
Copy code
@SpringBootTest
class SpringVarPathIssueApplicationTests {

    private val webClient = WebClient.builder().build()

    @Test
    fun testSimpleController(): Unit = runBlocking {

        val response = webClient
            .get()
            .uri("/get")
            .retrieve()
            .awaitBody<String>()

        println("response: $response")
    }
}
c

Chris Lee

07/17/2022, 2:51 PM
you’re making an http call to an IP address where no one is listening. looks like the code doesn’t specify a hostname.
g

George

07/17/2022, 4:25 PM
you mean like this
Copy code
uri("localhost:8080/api")
?
yup i indeed missed the hostname... (i am dumb 🙃) Thanks for the help!
680 Views