jeecgboot/JeecgBoot · error · JeecgBootException

网页解析失败:

Error message

网页解析失败: 

What it means

Thrown by EmbeddingHandler.parseWebPage() as a catch-all for any non-JeecgBootException during web page parsing. JeecgBootExceptions (errors 106, 107) are re-thrown as-is; all other exceptions are caught, logged, and wrapped with the original message. This covers network errors, parsing exceptions, and timeout failures.

Source

Thrown at jeecg-boot/jeecg-boot-module/jeecg-boot-module-airag/src/main/java/org/jeecg/modules/airag/llm/handler/EmbeddingHandler.java:788

        Matcher matcher = LLMConsts.WEB_PATTERN.matcher(website);
        if (!matcher.matches()) {
            throw new JeecgBootException("网页URL格式不正确,请以http://或https://开头");
        }

        try {
            WebPageParser webPageParser = new WebPageParser();
            String content = webPageParser.parseToMarkdown(website);
            if (oConvertUtils.isEmpty(content)) {
                throw new JeecgBootException("网页内容为空,请检查URL是否可访问");
            }
            log.info("网页解析成功, URL: {}, 内容长度: {}", website, content.length());
            return content;
        } catch (JeecgBootException e) {
            throw e;
        } catch (Exception e) {
            log.error("网页解析失败, URL: {}, 错误: {}", website, e.getMessage(), e);
            throw new JeecgBootException("网页解析失败: " + e.getMessage());
        }
    }

    /**
     * 解析文件
     *
     * @param doc
     * @author chenrui
     * @date 2025/3/5 11:31
     */
    private String parseFile(AiragKnowledgeDoc doc) {
        String metadata = doc.getMetadata();
        AssertUtils.assertNotEmpty("请先上传文件", metadata);
        JSONObject metadataJson = JSONObject.parseObject(metadata);
        if (!metadataJson.containsKey(LLMConsts.KNOWLEDGE_DOC_METADATA_FILEPATH)) {
            throw new JeecgBootException("请先上传文件");
        }
        String filePath = metadataJson.getString(LLMConsts.KNOWLEDGE_DOC_METADATA_FILEPATH);

View on GitHub (pinned to 96fb33f5ec)

Solutions

  1. Check the error message after '网页解析失败: ' — it contains the original exception's message identifying the root cause.
  2. Verify the server can reach the target URL (test with curl from the application host).
  3. For SSL errors, verify the target site's certificate is valid and the Java trust store includes the CA.
  4. For timeout errors, check network latency and firewall rules.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    String content = parseWebPage(doc);
} catch (JeecgBootException e) {
    if (e.getMessage().startsWith("网页解析失败")) {
        log.error("Web page parsing failed for doc: {}", doc.getId(), e);
        throw new JeecgBootException("网页解析失败,请检查URL是否可访问及网络连接");
    }
    throw e;
}

Prevention

When it happens

Trigger: WebPageParser.parseToMarkdown() throws an IOException (connection refused, DNS failure, socket timeout), a malformed-URL exception, an HTML parse exception, or any RuntimeException during content extraction. The original exception's message is appended to '网页解析失败: '.

Common situations: Target website is down or unreachable; DNS resolution fails for the domain; connection times out; SSL/TLS handshake fails for https URLs; the HTML is malformed causing the parser to throw; firewall blocks outbound HTTP from the server.

Related errors


AI-assisted analysis of jeecgboot/JeecgBoot@96fb33f5ec (2026-08-14). Data as JSON: /api/errors/9abc87905151ae6c. Report an issue: GitHub.