Windows10下OfBiz启动后多数Web组件无法访问求助
环境信息
- 系统:Windows 10 Enterprise
- OfBiz版本:18.12.08
- 数据库:Postgresql 15.3(已加载演示数据)
- Gradle:8.3
- JDK:17.0.8.101
问题现象
执行./gradlew ofbiz构建启动成功,但仅https://localhost:10523/webtools可访问,其余Web组件均无法通过浏览器或curl连接:
curl测试输出
D:\01Download>curl https://localhost:50746/webtools curl: (7) Failed to connect to localhost port 50746 after 2249 ms: Couldn't connect to server D:\01Download>curl https://localhost:10523/webtools curl: (35) schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - The token supplied to the function is invalid D:\01Download>curl https://localhost:8443/webtools curl: (28) SSL/TLS connection timeout
(浏览器提示localhost拒绝连接8443端口)
日志提示
INFO: No global web.xml found(仅出现1次)INFO: No Spring WebApplicationInitializer types detected on classpath(多次出现)
构建状态
Gradle构建无失败,但存在7项弃用提示。
解决步骤
检查端口配置与占用
打开framework/base/config/general.properties,确认port.https(默认8443)等端口未被其他程序占用。可用netstat -ano | findstr :8443检查,若占用则修改端口值后重启OfBiz。信任SSL自签名证书
访问https://localhost:10523/webtools时,浏览器会提示证书不安全,选择「高级」->「继续访问」手动信任证书,解决schannel令牌错误。若需长期解决,可替换framework/resources/security/keystore.jks为自定义证书并导入Windows证书存储。验证Web组件部署
查看OfBiz启动日志,确认party、order等Web组件是否有Initializing Spring root WebApplicationContext类似的成功启动记录。若缺失,检查framework/webapp/config/ofbiz-component.xml中是否包含对应组件的<webapp>配置,确保组件已加载。降级Gradle版本
Gradle 8.3与OfBiz 18.12.08存在兼容性问题,将Gradle降级至7.6版本,执行./gradlew clean build ofbiz重新构建,避免弃用特性导致的部署异常。确认数据库连接正常
检查framework/base/config/datasource.properties中的PostgreSQL连接参数(URL、用户名、密码)是否正确,确保OfBiz能正常读取演示数据,部分Web组件依赖数据库初始化数据才能启动。
内容的提问来源于stack exchange,提问作者Sirngweo

