Apache Tika 4.1.0 常用 CLI 命令与工具详解

汇总 Apache Tika 4.1.0 命令行工具 tika-app 常用命令:类型探测、文本与元数据抽取、JSON 与 XHTML 输出、语言检测、摘要计算、附件解包、解析器清单,以及 Fork 与 Pipes 批量模式,回显均实测。

Apache TikaApache Tika2026/10/12

Apache Tika 4.1.0 常用 CLI 命令与工具详解

一、环境信息

项目值
操作系统Ubuntu 22.04 LTS(Jammy)
工具tika-app 4.1.0(官方命令行工具)
Java 版本OpenJDK 17.0.20.1
工具目录/opt/tika-cli
启动 jartika-app-4.1.0.jar(120KB 瘦启动 jar,依赖位于同目录 lib)
样本目录/opt/samples
执行账号root

二、工具概览

  1. tika-app 是 Apache Tika 官方提供的单机命令行工具,与 tika-server 共用同一套解析核心与组件注册名机制,适合单文件排查、格式探测、元数据查看与单机批量处理。
  2. 4.x 起 tika-app 以 zip 发行包交付,包内是一个约 120KB 的瘦启动 jar 与相邻的 lib 依赖目录,使用 java -jar 启动即可,不要把瘦 jar 单独拷出目录运行。
  3. 三种运行模式:默认单文件解析模式、Fork 隔离模式(-f,解析在子 JVM 进程执行,防崩溃与超时拖垮主进程)、Pipes 批量模式(-i 与 -o 指定输入输出目录,多进程并行处理整个目录)。
  4. 输出格式:markdown(4.1.0 默认)、text、xhtml、html、metadata、json、xmp,可互相叠加(如 --json --pretty-print)。

三、前置条件

  1. 已安装 Java 11 及以上运行环境,实测使用 OpenJDK 17。
  2. 下载发行包:
mkdir -p /opt/tika-dl && cd /opt/tika-dl
curl -sSL -o tika-app-4.1.0.zip https://downloads.apache.org/tika/4.1.0/tika-app-4.1.0.zip -w 'HTTP %{http_code} size=%{size_download}\n'
  1. 解压部署到 /opt/tika-cli:
mkdir -p /opt/tika-cli && unzip -qo /opt/tika-dl/tika-app-4.1.0.zip -d /opt/tika-cli

查看部署结果:

ls -lh /opt/tika-cli
total 208K
-rw-r--r-- 1 root root  74K Sep 26 14:59 LICENSE
-rw-r--r-- 1 root root  178 Sep 26 14:59 NOTICE
drwxr-xr-x 2 root root 4.0K Sep 26 14:59 lib
drwxr-xr-x 3 root root 4.0K Sep 26 14:59 plugins
-rw-r--r-- 1 root root 120K Sep 26 14:59 tika-app-4.1.0.jar
  1. 准备样本文件(本文后续示例全部基于这三个样本):
mkdir -p /opt/samples
printf 'Hello Apache Tika!\nThis is a plain text sample file for content detection tests.\n' > /opt/samples/hello.txt

PDF 样本可用如下 python3 脚本生成最小合法 PDF(保存为 /opt/samples/gen_pdf.py 后执行 python3 /opt/samples/gen_pdf.py):

from itertools import accumulate
objs = [
    b"<< /Type /Catalog /Pages 2 0 R >>",
    b"<< /Type /Pages /Kids [3 0 R] /Count 1 >>",
    b"<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>",
]
stream = b"BT /F1 24 Tf 100 700 Td (Hello Apache Tika PDF sample) Tj ET"
objs.append(b"<< /Length %d >>\nstream\n%s\nendstream" % (len(stream), stream))
objs.append(b"<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>")
head = b"%PDF-1.4\n"
chunks = [b"%d 0 obj\n%s\nendobj\n" % (i, o) for i, o in enumerate(objs, start=1)]
offsets = [len(head)] + list(accumulate(len(c) for c in chunks))[:-1]
pdf = head + b"".join(chunks)
xref = len(pdf)
pdf += b"xref\n0 %d\n" % (len(objs) + 1) + b"0000000000 65535 f \n"
pdf += b"".join(b"%010d 00000 n \n" % off for off in offsets)
pdf += b"trailer\n<< /Size %d /Root 1 0 R >>\nstartxref\n%d\n%%%%EOF\n" % (len(objs) + 1, xref)
open("/opt/samples/hello.pdf", "wb").write(pdf)

PNG 样本可用 python3 生成 4 像素纯色图并保存为 /opt/samples/pixel.png。

四、工具详解

以下命令均在 /opt/tika-cli 目录执行。若无特别说明,INFO 级日志输出到 stderr、结果输出到 stdout,示例回显为 stdout 内容。

4.1 版本查看(--version)

java -jar tika-app-4.1.0.jar --version
Apache Tika 4.1.0

4.2 --help 与选项总览

java -jar tika-app-4.1.0.jar --help

输出选项区完整回显(帮助首行为 usage 提示,说明支持选项与文件两类参数;末尾的 Description 说明段与内容输出无关,此处从略):

Options:
    -?  or --help          Print this usage message
    -v  or --verbose       Print debug level messages
    -V  or --version       Print the Apache Tika version number

    -g  or --gui           Start the Apache Tika GUI

    --config=<tika-config.json>
        TikaConfig file (JSON as of Tika 4.x). Must be specified before -g or -f !
    --convert-config-xml-to-json=<input.xml>
        Convert a legacy 3.x XML config to 4.x JSON format (parsers section only),
        writing the JSON to stdout. Redirect to save, e.g.:
        --convert-config-xml-to-json=tika-config.xml > tika-config.json

    -x  or --xml           Output XHTML content
    -h  or --html          Output HTML content
    -t  or --text          Output plain text content (body)
    --md                   Output Markdown content (body) (default)
    -T  or --text-main     Output plain text content (main content only via boilerpipe handler)
    -A  or --text-all      Output all text content
    -m  or --metadata      Output only metadata
    -j  or --json          Output metadata in JSON
    -y  or --xmp           Output metadata in XMP
    -J  or --jsonRecursive Output metadata and content from all
                           embedded files (choose content type
                           with -x, -h, -t or -m; default is --md)
    -a  or --async         Run Tika in async mode: -a -c <tika-config.json> [-p <pluginsDir>]
    -l  or --language      Output only language
    -d  or --detect        Detect document type
           --digest=X      Include digest X (md2, md5, sha1,
                               sha256, sha384, sha512)
    --encoding=X           Use output encoding X
    --password=X           Use document password X
    -z  or --extract       Extract all attachements into current directory
    --extract-dir=<dir>    Specify target directory for -z
    --maxEmbeddedDepth=X   Maximum depth for embedded document extraction
    --maxEmbeddedCount=X   Maximum number of embedded documents to extract
    -r  or --pretty-print  For JSON, XML and XHTML outputs, adds newlines and
                           whitespace, for better readability

Fork Mode (process isolation):
    -f  or --fork          Run parsing in a forked JVM process for isolation
                           Protects against parser crashes, OOM, and timeouts
    --task-timeout=<ms>    Total per-file budget in milliseconds
                           (default: 3600000)
    --progress-timeout=<ms> Stall detector: max time with no progress
                           (default: 120000)
    --fork-jvm-args=<args> JVM args for forked process (comma-separated)
                           e.g., --fork-jvm-args=-Xmx512m,-Dsome.prop=value
    --fork-plugins-dir=<dir> Directory containing plugin zips

    --list-parsers
         List the available document parsers
    --list-parser-names
         List parsers as tab-separated class-name<TAB>friendly-name
         (friendly names are the kebab-case keys used in JSON config)
    --list-parser-details
         List the available document parsers and their supported mime types
    --list-parser-details-apt
         List the available document parsers and their supported mime types in apt format.
    --list-parser-details-adoc
         Same, in AsciiDoc; regenerates docs/modules/ROOT/partials/supported-formats.adoc
    --list-detectors
         List the available document detectors
    --list-detector-names
         List detectors as tab-separated class-name<TAB>friendly-name
    --list-met-models
         List the available metadata models, and their supported keys
    --list-supported-types
         List all known media types and related information

    --compare-file-magic=<dir>
         Compares Tika's known media types to the File(1) tool's magic directory

Tika Pipes Options:
    -i, --inputDir=<dir>       Input directory
    -o, --outputDir=<dir>      Output directory
    -n, --numClients           Number of forked processes
    --Xmx=<size>               -Xmx for the forked processes, e.g. --Xmx=1g
    -T, --timeoutMillis        Timeout for each parse in milliseconds
    -c, --config=<file>        Tika config file (--config=<file> also accepted)
    -p, --pluginsDir           Plugins directory
    --fileList                 File list (one path per line, relative to --inputDir or absolute)
    --handler                  Handler type: t=text, h=html, x=xml, m=markdown, b=body, i=ignore (default: m)
    --concatenate              Concatenate content from all embedded documents
    --content-only             Output only extracted content (no JSON wrapper); implies --concatenate
    --on-exists                Behavior when an output file exists: exception (default), replace, skip
    -Z                         Recursively unpack all the attachments, too
    --unpack-format=<format>   Output format: REGULAR (default) or FRICTIONLESS
    --unpack-mode=<mode>       Output mode: ZIPPED (default) or DIRECTORY;
                               DIRECTORY when --unpack-format=FRICTIONLESS and no mode is given
    --unpack-include-metadata  Metadata for every extracted file. A Frictionless package
                               carries metadata.json by default; this adds per-file
                               sidecars to REGULAR zip output

4.3 类型探测(--detect)

java -jar tika-app-4.1.0.jar --detect /opt/samples/hello.txt
text/plain
java -jar tika-app-4.1.0.jar --detect /opt/samples/hello.pdf
application/pdf
java -jar tika-app-4.1.0.jar --detect /opt/samples/pixel.png
image/png

说明:探测结果综合文件内容魔数与文件名信息。每次运行都会在 stderr 打印一条 INFO 提示(关键句为 As a convenience, TikaCLI has turned on several non-default features,并注明 This is not the default behavior in Tika generally or in tika-server),即 tika-app 单文件模式默认开启了若干非默认特性,因此个别场景下 tika-app 与 tika-server 的行为可能存在差异。

4.4 纯文本抽取(--text)

java -jar tika-app-4.1.0.jar --text /opt/samples/hello.pdf

Hello Apache Tika PDF sample

4.5 元数据输出(--metadata)

java -jar tika-app-4.1.0.jar --metadata /opt/samples/hello.pdf

完整回显(共 35 行):

Content-Length: 604
Content-Type: application/pdf
access-permission:assemble-document: true
access-permission:can-modify: true
access-permission:can-print: true
access-permission:can-print-faithful: true
access-permission:extract-content: true
access-permission:extract-for-accessibility: true
access-permission:fill-in-form: true
access-permission:modify-annotations: true
dc:format: application/pdf; version=1.4
pdf:chars-per-page: 28
pdf:contains-damaged-font: false
pdf:contains-non-embedded-font: true
pdf:encrypted: false
pdf:eof-offsets: 604
pdf:has-collection: false
pdf:has-marked-content: false
pdf:has-xfa: false
pdf:has-xmp: false
pdf:incremental-update-count: 0
pdf:num-3d-annotations: 0
pdf:ocr-page-count: 0
pdf:overall-percentage-unmapped-unicode-chars: 0.0
pdf:pdf-version: 1.4
pdf:total-unmapped-unicode-chars: 0
pdf:unmapped-unicode-chars-per-page: 0
tk:content-type-magic-detected: application/pdf
tk:parsed-by: org.apache.tika.parser.CompositeParser
tk:parsed-by: org.apache.tika.parser.pdf.PDFParser
tk:parsed-by-full-set: org.apache.tika.parser.CompositeParser
tk:parsed-by-full-set: org.apache.tika.parser.pdf.PDFParser
tk:resource-name: hello.pdf
tk:version-count: 0
xmpTPg:NPages: 1

4.6 JSON 输出(--json --pretty-print)

java -jar tika-app-4.1.0.jar --json --pretty-print /opt/samples/pixel.png
{
  "Content-Length" : "73",
  "Content-Type" : "image/png",
  "img:Chroma BlackIsZero" : "true",
  "img:Chroma ColorSpaceType" : "RGB",
  "img:Chroma NumChannels" : "3",
  "img:Compression CompressionTypeName" : "deflate",
  "img:Compression Lossless" : "true",
  "img:Compression NumProgressiveScans" : "1",
  "img:Data BitsPerSample" : "8 8 8",
  "img:Data PlanarConfiguration" : "PixelInterleaved",
  "img:Data SampleFormat" : "UnsignedIntegral",
  "img:Dimension ImageOrientation" : "Normal",
  "img:Dimension PixelAspectRatio" : "1.0",
  "img:IHDR" : "width=4, height=4, bitDepth=8, colorType=RGB, compressionMethod=deflate, filterMethod=adaptive, interlaceMethod=none",
  "img:Transparency Alpha" : "none",
  "img:height" : "4",
  "img:width" : "4",
  "tiff:BitsPerSample" : "8 8 8",
  "tiff:ImageLength" : "4",
  "tiff:ImageWidth" : "4",
  "tk:content-type-magic-detected" : "image/png",
  "tk:num-images" : "1",
  "tk:parsed-by" : [ "org.apache.tika.parser.CompositeParser", "org.apache.tika.parser.DefaultParser", "org.apache.tika.parser.image.ImageParser" ],
  "tk:parsed-by-full-set" : [ "org.apache.tika.parser.CompositeParser", "org.apache.tika.parser.DefaultParser", "org.apache.tika.parser.image.ImageParser" ],
  "tk:resource-name" : "pixel.png"
}

4.7 语言检测(--language)

java -jar tika-app-4.1.0.jar --language /opt/samples/hello.txt
eng

4.8 XHTML 输出(--xml)

java -jar tika-app-4.1.0.jar --xml /opt/samples/hello.txt
<?xml version="1.0" encoding="UTF-8"?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="tk:encoding-detection-trace" content="MojibusterEncodingDetector-&gt;windows-1252[STATISTICAL](0.10)"/>
<meta name="tk:detected-encoding" content="windows-1252"/>
<meta name="tk:content-type-magic-detected" content="text/plain"/>
<meta name="tk:encoding-detector" content="MojibusterEncodingDetector"/>
<meta name="Content-Encoding" content="windows-1252"/>
<meta name="tk:resource-name" content="hello.txt"/>
<meta name="Content-Length" content="81"/>
<meta name="tk:parsed-by" content="org.apache.tika.parser.CompositeParser"/>
<meta name="tk:parsed-by" content="org.apache.tika.parser.DefaultParser"/>
<meta name="tk:parsed-by" content="org.apache.tika.parser.csv.TextAndCSVParser"/>
<meta name="Content-Type" content="text/plain; charset=windows-1252"/>
<title/>
</head>
<body><p>Hello Apache Tika!
This is a plain text sample file for content detection tests.
</p>
</body></html>

4.9 摘要计算(--digest)

结合 -m 输出含摘要的元数据:

java -jar tika-app-4.1.0.jar --digest=sha256 -m /opt/samples/hello.txt
Content-Encoding: windows-1252
Content-Length: 81
Content-Type: text/plain; charset=windows-1252
tk:content-type-magic-detected: text/plain
tk:detected-encoding: windows-1252
tk:digest:SHA-256: 6f351bb6e3a9ef3c5b87906bdd348db2cb5f5e6fd8980fb16d18812fcce06538
tk:encoding-detection-trace: MojibusterEncodingDetector->windows-1252[STATISTICAL](0.10)
tk:encoding-detector: MojibusterEncodingDetector

说明:摘要结果位于 tk:digest:SHA-256 键。无 BOM 的纯 ASCII 文本被编码检测器按字符统计判定为 windows-1252(回显中 tk:encoding-detection-trace 记录了判定轨迹),属检测器正常行为,不影响摘要值。

4.10 附件解包(--extract --extract-dir)

构造一个含两个内嵌文件的 zip 样本:

mkdir -p /tmp/ziptest && cd /tmp/ziptest
printf 'embedded file one\n' > a.txt
printf 'embedded file two\n' > b.txt
zip -q inner.zip a.txt b.txt
ls -l inner.zip
-rw-r--r-- 1 root root 334 Oct 12 09:52 inner.zip

解包到指定目录(过程日志输出到 stderr,stdout 无输出):

cd /opt/tika-cli && java -jar tika-app-4.1.0.jar --extract --extract-dir=/tmp/ziptest/out /tmp/ziptest/inner.zip 2>/dev/null
find /tmp/ziptest/out -type f | sort
/tmp/ziptest/out/inner.zip-embed/00000001.bin
/tmp/ziptest/out/inner.zip-embed/00000002.bin
/tmp/ziptest/out/inner.zip.json

内嵌文件存入以源文件名命名的子目录,每个内嵌内容对应一个序号 bin 文件,json 文件记录全部元数据。若需同时解出 zip 内层嵌套压缩包,可在命令中追加 -Z。

4.11 解析器与支持类型清单

列出解析器树(实测 91 行,头 6 行):

java -jar tika-app-4.1.0.jar --list-parsers 2>/dev/null | wc -l
91
java -jar tika-app-4.1.0.jar --list-parsers 2>/dev/null | head -6
   org.apache.tika.parser.AutoDetectParser (Composite Parser):
      org.apache.tika.parser.CompositeParser (Composite Parser):
         org.apache.tika.parser.DefaultParser (Composite Parser):
            org.apache.tika.parser.apple.AppleSingleFileParser
            org.apache.tika.parser.apple.PListParser
            org.apache.tika.parser.asm.ClassParser

列出注册名对照表(88 行,注册名即 JSON 配置 parsers 块使用的 kebab-case 名,头 8 行):

java -jar tika-app-4.1.0.jar --list-parser-names 2>/dev/null | head -8
org.apache.tika.parser.apple.AppleSingleFileParser      apple-single-file-parser
org.apache.tika.parser.apple.PListParser        p-list-parser
org.apache.tika.parser.asm.ClassParser  class-parser
org.apache.tika.parser.audio.AudioParser        audio-parser
org.apache.tika.parser.audio.MidiParser midi-parser
org.apache.tika.parser.code.SourceCodeParser    source-code-parser
org.apache.tika.parser.crypto.Pkcs7Parser       pkcs-7-parser
org.apache.tika.parser.crypto.TSDParser tsd-parser

列出全部支持的媒体类型(头 6 行):

java -jar tika-app-4.1.0.jar --list-supported-types 2>/dev/null | head -6
application/activemessage
  supertype: application/octet-stream
application/andrew-inset
  supertype: application/octet-stream
application/applefile
  supertype: application/octet-stream

4.12 Fork 隔离模式(-f)

java -jar tika-app-4.1.0.jar -f --text /opt/samples/hello.pdf 2>/dev/null

Hello Apache Tika PDF sample

结果与普通模式一致,差异在 stderr 的运行日志(实测摘录):解析发生在 fork 出的子 JVM 中,日志带 [fork] 与 pipesClientId 标记。

INFO  [main] org.apache.tika.pipes.core.PipesParser Using per-client server mode with 1 clients
INFO  [main] org.apache.tika.pipes.core.PerClientServerManager pipes-cpu-sizing: hostCores=12, numClients=1, parentReserved=2, autoCap=slice=10, heap=MaxRAMPercentage=60
INFO  [main] [fork] pipesClientId=0 org.apache.tika.pipes.core.server.PipesServer watching parent pid 6363 for exit
INFO  [main] [fork] pipesClientId=0 org.apache.tika.pipes.core.server.PipesServer forked JVM max heap: 19232 MB
INFO  [main] org.apache.tika.pipes.core.PipesClient clientId=0: server successfully started

要点:fork 模式固定 1 个解析子进程;子 JVM 监视父进程退出(watching parent pid)避免孤儿进程;--task-timeout 默认 3600000 毫秒、--progress-timeout 默认 120000 毫秒,可用 --fork-jvm-args 给子进程传 JVM 参数(逗号分隔,如 --fork-jvm-args=-Xmx512m)。解析不可信文件建议始终加 -f。

4.13 Pipes 批量模式(-i 与 -o)

准备输入目录并执行批量解析:

rm -rf /tmp/batch-in /tmp/batch-out && mkdir -p /tmp/batch-in /tmp/batch-out
cp /opt/samples/hello.txt /opt/samples/hello.pdf /tmp/batch-in/
cd /opt/tika-cli && java -jar tika-app-4.1.0.jar -i /tmp/batch-in -o /tmp/batch-out -n 2 -T 60000

日志关键行实测回显(时间戳从略):

WARN  [main] [fork] pipesClientId=0 org.apache.tika.config.TimeoutLimits progressTimeoutMillis (120000) > totalTaskTimeoutMillis (60000) -- the stall detector can never fire; set them equal to disable it deliberately
INFO  [main] [fork] pipesClientId=1 org.apache.tika.pipes.timing.worker WORKER_TIMING id=hello.txt req_deser_us=7848 ctx_merge_us=2160 intermediate_wait_us=117162 handoff_us=2642 fetch_us=20440 parse_us=379224 emit_us=281 worker_wall_us=400164 intermediate_us=184 resp_ser_us=7688 resp_write_us=134 resp_ack_us=2247 resp_bytes=926
INFO  [main] [fork] pipesClientId=0 org.apache.tika.pipes.timing.worker WORKER_TIMING id=hello.pdf req_deser_us=9781 ctx_merge_us=2085 intermediate_wait_us=133516 handoff_us=5148 fetch_us=23922 parse_us=542430 emit_us=277 worker_wall_us=566867 intermediate_us=205 resp_ser_us=4683 resp_write_us=138 resp_ack_us=357 resp_bytes=1410
INFO  [main] tika.pipes Successfully finished processing 2 files in 6312 ms

查看输出结果:

find /tmp/batch-out -type f | sort
/tmp/batch-out/hello.pdf.json
/tmp/batch-out/hello.txt.json

每个输入文件对应一个 json 输出(内容与元数据打包在一起,tk:content 字段为抽取文本,实测输出前 260 字符如下):

[{"tk:source-path":"hello.txt","tk:content-type-parser-override":"text/plain","tk:encoding-detection-trace":"MojibusterEncodingDetector->windows-1252[STATISTICAL](0.10)","tk:resource-name":"hello.txt","tk:content":"Hello Apache Tika! This is a plain text sampl

要点:

  1. -n 指定 fork 子进程数量,-T 指定单文件解析超时毫秒数,--Xmx 指定子进程堆(如 --Xmx=512m)。
  2. 默认输出为 json 包裹格式;只要纯文本可追加 --handler t 或 --content-only(后者隐含 --concatenate)。
  3. -T 小于 --progress-timeout 默认值时会出现上例的 WARN 提示,按提示把两个超时设为一致即可关闭该警告。
  4. 输出文件已存在时默认抛异常,可用 --on-exists=replace 或 --on-exists=skip 控制行为。

五、注意事项

  1. tika-app 的 INFO 日志走 stderr、结果走 stdout,脚本化采集结果时使用 2>/dev/null 过滤日志。
  2. 4.1.0 默认输出 markdown 内容,需要其他格式时显式加 -t、-x、-h、-m 或 -j。
  3. 每次运行约有数秒的 JVM 启动开销,逐文件循环调用效率低,多文件场景优先使用 4.13 的 Pipes 批量模式。
  4. Fork 与 Pipes 模式都会 fork 子 JVM,低内存服务器需结合 --Xmx 与 -n 控制子进程内存。
  5. --config 加载的 JSON 配置必须放在 -g 或 -f 之前(帮助原文明确 Must be specified before -g or -f)。
  6. GUI(-g)与 async(-a)模式面向桌面与常驻管道场景,服务器批量处理场景本文不展开。

六、常见问题

Q1:输出里混着大量 INFO 日志怎么办? 这些日志走 stderr,结果走 stdout。在命令末尾追加 2>/dev/null 即可只保留结果;需要排查时去掉该重定向查看完整日志。

Q2:为什么 tika-app 与 tika-server 对同一文件的行为略有差异? tika-app 单文件模式启动时会自动开启若干非默认特性(日志原文注明 See: TIKA-2374, TIKA-4017, TIKA-4354 and TIKA-4472,且强调 This is not the default behavior in Tika generally or in tika-server)。需要与 server 严格对齐时,用 --config 指定同一份 JSON 配置。

Q3:Pipes 批量模式输出的是 json,如何直接得到纯文本? 追加 --handler t(文本输出)或 --content-only(仅内容、无 JSON 包裹)。输出文件名跟随输入文件名,扩展名按输出处理器变化。

Q4:出现 progressTimeoutMillis 大于 totalTaskTimeoutMillis 的 WARN? 表示无进度检测器永远不会触发。按日志提示将 --task-timeout 与 --progress-timeout 设为相同值即可刻意禁用该检测器,或让 task-timeout 大于 progress-timeout 保持检测有效。

Q5:解析大文件或不可信文件担心内存与崩溃? 使用 -f Fork 模式并配合 --fork-jvm-args=-Xmx512m 限制子进程堆,配合 --task-timeout 限制单文件预算;子进程崩溃不会拖垮主进程。

Q6:报某组件未注册(如 OCR 相关解析器)? 部分解析器(帮助与报错原文以 Tess4J OCR 为例,位于 tika-parser-tess4j-module)以独立 jar 分发,需单独加入后才能在注册名表中出现。用 --list-parser-names 确认目标注册名是否存在。

七、参考链接

  1. Apache Tika 官方下载页:https://tika.apache.org/download.html
  2. Tika 4.1.0 发行包目录:https://downloads.apache.org/tika/4.1.0/
  3. Tika 官方项目主页:https://tika.apache.org/
  4. Tika 用户邮件列表归档:https://lists.apache.org/list.html?users@tika.apache.org