I'm having connection issues when trying to send REST requests from my Java Spring Boot application to identities via a single wildcard service, using the ziti-sdk-jvm
SDK.
The wildcard service and configurations look like:
{
"name": "my-service-name",
"roleAttributes": [
"my-role-attribute"
],
"configs": [
"my-config.intercept",
"my-config.host"
],
"encryptionRequired": true,
"terminatorStrategy": "smartrouting"
}
{
"name": "my-config.intercept",
"data": {
"portRanges": [
{
"high": 8765,
"low": 8765
}
],
"addresses": [
"*.ziti"
],
"dialOptions": {
"identity": "$dst_hostname"
},
"protocols": [
"tcp"
]
}
}
{
"name": "my-config.host",
"data": {
"protocol": "tcp",
"address": "localhost",
"forwardPort": true,
"allowedPortRanges": [
{
"high": 8765,
"low": 8765
}
],
"listenOptions": {
"bindUsingEdgeIdentity": true
}
}
}
Within the Spring Boot application, I'm creating a context using an identity which can dial this service, and I'm creating an OkHttpClient
, as shown in the SDK samples, to send REST requests to identities who can bind to the service.
On startup the ZitiDNSManager
reports the services that are available, but instead of my-service-name
it outputs (which I assume is correct):
org.openziti.net.dns.ZitiDNSManager: registered Domain(name=*.ziti)
When I then attempt to send a REST request to one of the binded identities, I get the following error (note that the ZitiDNSManager
assigns the identity when the request is made):
2025-06-11T08:51:25.368Z INFO 64 --- [nio-8080-exec-1] org.openziti.net.dns.ZitiDNSManager : assigned my-identity-name.ziti => my-identity-name.ziti/100.64.1.8 [*.ziti]
2025-06-11T08:51:25.400Z WARN 64 --- [health:8765/...] o.o.net.ZitiSocketFactory$ZitiConnector : md3xy.tdpq: java.nio.channels.UnresolvedAddressException
2025-06-11T08:51:25.400Z INFO 64 --- [health:8765/...] o.o.net.ZitiSocketFactory$ZitiConnector : no ZitiContext provides service for my-identity-name.ziti/100.64.1.8:8765
2025-06-11T08:51:27.301Z ERROR 64 --- [nio-8080-exec-1] c.r.e.e.ControllerExceptionHandler : Internal Server Error
java.lang.RuntimeException: Ziti request failed: java.net.ConnectException: Connection refused
I've managed to get this working using ZDEW and Postman, with the same identities as the Spring Boot application. Therefore, it seems my identities and service are configured correctly, and I believe I'm maybe doing something wrong on the Java side.
From looking through other examples, I can see that they generally dial the service directly (instead of using something like OkHttpClient
), and use dial options to pass the identity (which I assume sets dst_hostname
). Should I be doing that instead? Is that possible using the Java SDK?