NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
51.9k stars 5.89k forks source link

osgi raise a exception: java.lang.ClassNotFoundException #6793

Closed Squirre17 closed 3 months ago

Squirre17 commented 3 months ago
ERROR REPORT SCRIPT ERROR: FindTextScript.java : FindTextScript (HeadlessAnalyzer) java.lang.ClassNotFoundException: FindTextScript
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:2075)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)
        at ghidra.app.script.JavaScriptProvider.loadClass(JavaScriptProvider.java:127)
        at ghidra.app.script.JavaScriptProvider.getScriptInstance(JavaScriptProvider.java:85)
        at ghidra.app.util.headless.HeadlessAnalyzer.runScriptsList(HeadlessAnalyzer.java:895)
        at ghidra.app.util.headless.HeadlessAnalyzer.analyzeProgram(HeadlessAnalyzer.java:976)
        at ghidra.app.util.headless.HeadlessAnalyzer.processFileWithImport(HeadlessAnalyzer.java:1550)
        at ghidra.app.util.headless.HeadlessAnalyzer.processWithImport(HeadlessAnalyzer.java:1688)
        at ghidra.app.util.headless.HeadlessAnalyzer.processWithImport(HeadlessAnalyzer.java:1753)
        at ghidra.app.util.headless.HeadlessAnalyzer.processLocal(HeadlessAnalyzer.java:445)
        at ghidra.app.util.headless.AnalyzeHeadless.launch(AnalyzeHeadless.java:121)
        at ghidra.GhidraLauncher.launch(GhidraLauncher.java:59)
        at ghidra.Ghidra.main(Ghidra.java:47)
Caused by: org.osgi.framework.BundleException: Unable to resolve 47a51e26 [1](R 1.0): missing requirement [47a51e26 [1](R 1.0)] osgi.ee; (osgi.ee=UNKNOWN) Unresolved requirements: [[47a51e26 [1](R 1.0)] osgi.ee; (osgi.ee=UNKNOWN)]
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4368)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:2068)
        ... 12 more

seems like osgi can't found bundle location in ~/.ghidra/.ghidra_xxx/..

running command is following:

$GHIDRA_PATH/support/analyzeHeadless . Proj -import ./test -scriptPath $GHIDRA_PATH/Ghidra/Features/Base/ghidra_scripts/ -preScript  FindTextScript.java "aaaa" -log log -overwrite

jdk 21

cat ~/.ghidra/.ghidra_10.1.2_PUBLIC/java_home.save
~/bai/jdk-21.0.4+7
Squirre17 commented 3 months ago

caused by ghidra version mismatch jdk version