basic-03-configuration

(base) eric@Eric:~/EDCSample/Samples$ ./gradlew clean basic:basic-03-configuration:build

> Task :basic:basic-03-configuration:javadoc
/home/eric/EDCSample/Samples/basic/basic-03-configuration/src/main/java/org/eclipse/edc/extension/health/HealthApiController.java:30: warning: no comment
public class HealthApiController {
       ^
/home/eric/EDCSample/Samples/basic/basic-03-configuration/src/main/java/org/eclipse/edc/extension/health/HealthApiController.java:35: warning: no comment
    public HealthApiController(Monitor monitor, String logPrefix) {
           ^
/home/eric/EDCSample/Samples/basic/basic-03-configuration/src/main/java/org/eclipse/edc/extension/health/HealthApiController.java:42: warning: no comment
    public String checkHealth() {
                  ^
/home/eric/EDCSample/Samples/basic/basic-03-configuration/src/main/java/org/eclipse/edc/extension/health/HealthEndpointExtension.java:22: warning: no comment
public class HealthEndpointExtension implements ServiceExtension {
       ^
4 warnings

BUILD SUCCESSFUL in 10s
57 actionable tasks: 15 executed, 42 up-to-date
(base) eric@Eric:~/EDCSample/Samples$ java -jar basic/basic-03-configuration/build/libs/filesystem-config-connector.jar
INFO 2025-07-17T17:12:38.087044247 Booting EDC runtime
WARNING 2025-07-17T17:12:38.11316999 Configuration file does not exist: dataspaceconnector-configuration.properties. Ignoring.
WARNING 2025-07-17T17:12:38.119227577 The runtime is configured as an anonymous participant. DO NOT DO THIS IN PRODUCTION.
INFO 2025-07-17T17:12:38.220269822 HTTPS enforcement it not enabled, please enable it in a production environment
WARNING 2025-07-17T17:12:38.315321408 Config value: no setting found for 'edc.hostname', falling back to default value 'localhost'
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
WARNING 2025-07-17T17:12:38.468897502 Using the InMemoryVault is not suitable for production scenarios and should be replaced with an actual Vault!
INFO 2025-07-17T17:12:38.848655601 10 service extensions started
INFO 2025-07-17T17:12:38.850109027 Runtime 2134f19d-c198-4455-bb81-d138d6bcffd4 ready
^CINFO 2025-07-17T17:12:43.104757507 Shutdown complete
INFO 2025-07-17T17:12:43.105270189 Cleanup complete
(base) eric@Eric:~/EDCSample/Samples$ 

EDC开发环境配置完整解决方案总结

核心问题解决历程

1. 路径配置的关键发现

问题现象:

# ❌ 失败:使用~路径
java -Dedc.fs.config=~/edc-config/dataspaceconnector-configuration.properties
WARNING Configuration file does not exist: ~/edc-config/dataspaceconnector-configuration.properties

# ✅ 成功:使用绝对路径  
java -Dedc.fs.config=/home/eric/edc-config/dataspaceconnector-configuration.properties
INFO 10 service extensions started
INFO MyCustomPrefix :: Received a health request

根本原因:

  • Java系统属性不支持Shell路径展开 - ~符号不会被展开为用户家目录
  • 必须使用绝对路径或相对路径 - Java直接传递路径字符串,不经过Shell处理

2. 完整的环境配置解决方案

方案1:标准配置文件方式(推荐)

# 1. 创建配置目录和文件
mkdir -p ~/edc-config
cat > ~/edc-config/edc.properties << 'EOF'
# EDC核心配置
web.http.port=9191
web.http.path=/api
edc.hostname=localhost

# 应用特定配置  
edc.samples.basic.03.logprefix=MyCustomPrefix

# 代理配置(如需要)
# edc.http.client.proxy.enabled=true
# edc.http.client.proxy.host=127.0.0.1
# edc.http.client.proxy.port=7890
EOF

# 2. 创建启动脚本
cat > ~/bin/start-edc.sh << 'EOF'
#!/bin/bash
# EDC标准启动脚本

# 清理可能冲突的环境变量
unset HTTP_PROXY HTTPS_PROXY NO_PROXY
unset http_proxy https_proxy no_proxy

# 使用绝对路径启动EDC
CONFIG_FILE="$HOME/edc-config/edc.properties"
if [ ! -f "$CONFIG_FILE" ]; then
    echo "配置文件不存在: $CONFIG_FILE"
    exit 1
fi

echo "使用配置文件: $CONFIG_FILE"
java -Dedc.fs.config="$CONFIG_FILE" -jar "$@"
EOF

chmod +x ~/bin/start-edc.sh

# 3. 使用方式
~/bin/start-edc.sh basic/basic-03-configuration/build/libs/filesystem-config-connector.jar
(base) eric@Eric:~/EDCSample/Samples$ java -Dedc.fs.config=/home/eric/edc-config/dataspaceconnector-configuration.properties -jar basic/basic-03-configuration/build/libs/filesystem-config-connector.jar
INFO 2025-07-17T17:17:32.268163085 Booting EDC runtime
WARNING 2025-07-17T17:17:32.30153611 The runtime is configured as an anonymous participant. DO NOT DO THIS IN PRODUCTION.
INFO 2025-07-17T17:17:32.406439416 HTTPS enforcement it not enabled, please enable it in a production environment
WARNING 2025-07-17T17:17:32.511109369 Config value: no setting found for 'edc.hostname', falling back to default value 'localhost'
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
WARNING 2025-07-17T17:17:32.672468712 Using the InMemoryVault is not suitable for production scenarios and should be replaced with an actual Vault!
INFO 2025-07-17T17:17:33.068565971 10 service extensions started
INFO 2025-07-17T17:17:33.069611544 Runtime 26a8104a-686c-4326-902f-7ac6ee97c924 ready
INFO 2025-07-17T17:18:10.137734534 MyCustomPrefix :: Received a health request

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值