Docker环境下Fuseki上传RDF模型遇连接拒绝问题求助
Hey Jakob, let's break down this connection refused issue step by step—Docker networking is usually the culprit here, so let's start with the most common fixes:
First off, make sure your Payara and Fuseki containers are on the same Docker network. The default bridge network has limited DNS resolution, so a custom network is way more reliable:
# Create a dedicated network for your services docker network create fuseki-payara-network # Restart Fuseki with the new network docker run --network=fuseki-payara-network --name=fuseki [your-fuseki-image] --host 0.0.0.0 # Restart Payara with the same network docker run --network=fuseki-payara-network --name=payara [your-payara-image]
Test connectivity from inside the Payara container to rule out network isolation:
# Enter the Payara container docker exec -it payara bash # Ping the Fuseki container (Docker DNS will resolve the container name to its IP) ping fuseki
If this fails, the containers aren't on the same network—fix that first.
A super common gotcha: Fuseki often defaults to binding only to localhost inside its container, which blocks access from other containers. Make sure you start Fuseki with --host 0.0.0.0 to allow external connections:
docker run --network=fuseki-payara-network --name=fuseki apache/jena-fuseki:latest --host 0.0.0.0 --port 3030
Verify the endpoint is reachable from Payara:
curl http://fuseki:3030/$/ping
You should get a pong response if Fuseki is accessible.
Double-check your createHTTP() setup—don't use localhost in the Fuseki URL from inside Payara! localhost refers to the Payara container itself, not Fuseki. Use the Fuseki container name or its internal IP instead. Example working config:
HttpClient customClient = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(15)) .build(); // Use the container name "fuseki" instead of localhost Dataset dataset = DatasetFactory.createHTTP("http://fuseki:3030/your-target-dataset", customClient);
Also, ensure your client isn't enforcing a proxy or restrictive connection rules that block internal Docker traffic.
If you added port mapping like -p 3030:3030 to your Fuseki run command, note that's only for host machine access. Container-to-container communication uses the internal port (3030 by default) directly—you don't need port mapping for that.
Check Fuseki's logs to confirm it's listening on the right address:
docker logs fuseki
Look for a line like Listening on http://0.0.0.0:3030/—that means it's open to external connections.
Check Payara's logs too for more detailed errors (like DNS failures or timeouts instead of just "connection refused"):
docker logs payara
内容的提问来源于stack exchange,提问作者Jakob

