You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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:

1. Confirm Docker Network Alignment

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.

2. Fix Fuseki's Listening Address

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.

3. Correct Your HTTP Client & URL

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.

4. Skip Unnecessary Port Mapping (For Container-to-Container)

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.

5. Dig Into Logs for Hidden Clues

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 03:25:56