Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java error running ghidra export #144

Open
BonusPlay opened this issue Dec 29, 2024 · 6 comments
Open

Java error running ghidra export #144

BonusPlay opened this issue Dec 29, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@BonusPlay
Copy link

Running latest commit, JDK 21, ghidra 11.2.1.

Could not initialize class com.google.security.zynamics.BinExport$BinExport2
java.lang.NoClassDefFoundError: Could not initialize class com.google.security.zynamics.BinExport$BinExport2
	at com.google.security.binexport.BinExport2Builder.<init>(BinExport2Builder.java:81)
	at com.google.security.binexport.BinExportExporter.export(BinExportExporter.java:92)
	at ghidra.app.plugin.core.exporter.ExporterDialog$ExportTask.run(ExporterDialog.java:578)
	at ghidra.util.task.Task.monitoredRun(Task.java:134)
	at ghidra.util.task.TaskRunner.lambda$startTaskThread$0(TaskRunner.java:106)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.ExceptionInInitializerError: Exception java.lang.IllegalAccessError: class com.google.security.zynamics.BinExport$BinExport2 tried to access method 'com.google.protobuf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyList()' (com.google.security.zynamics.BinExport$BinExport2 and com.google.protobuf.LazyStringArrayList are in unnamed module of loader ghidra.GhidraClassLoader @483bf400) [in thread "Task - Export visualboyadvance-m---.exe"]
	at com.google.security.zynamics.BinExport$BinExport2.<init>(BinExport.java:19352)
	at com.google.security.zynamics.BinExport$BinExport2.<clinit>(BinExport.java:25089)
	... 8 more

---------------------------------------------------
Build Date: 2024-Nov-05
Ghidra Version: 11.2.1
Java Home: /nix/store/f042x32jfm94d3cgaga8d6xl8vy6sg46-openjdk-21.0.5+11/lib/openjdk
JVM Version: N/A 21.0.5
OS: Linux 6.12.6 amd64
@cblichmann cblichmann added the bug Something isn't working label Jan 6, 2025
@cblichmann
Copy link
Member

Did you build the extension yourself or did you use the release binary?

How did you launch Ghidra? Is this using it headless from the command-line?

@BonusPlay
Copy link
Author

Built myself (latest commit is newer than release binary), ghidra ran with UI.

@cblichmann
Copy link
Member

This is odd, it looks like the Gradle build did not add the Protobuf dependency correctly.

@BonusPlay
Copy link
Author

I'll try to debug this issue a bit, as this might be caused by nix-related build stuff. I can see following classes in the ghidra-binexport.jar, but have no clue why it isn't working...

1980-02-01 00:00:00 .....         2112          905  com/google/protobuf/LazyStringArrayList$ByteArrayListView.class
1980-02-01 00:00:00 .....         2419          921  com/google/protobuf/LazyStringArrayList$ByteStringListView.class
1980-02-01 00:00:00 .....        11117         3951  com/google/protobuf/LazyStringArrayList.class

@tonybounty
Copy link

tonybounty commented Feb 7, 2025

I use Ghidra in headless mode, so I built extension and unzipped it in Ghidra/Extensions folder.
I'm facing the same bug with fresh Ghidra 11.3 (JDK 21.0.6) in headless mode

ERROR Abort due to Headless analyzer error: class com.google.security.zynamics.BinExport$BinExport2 tried
 to access method 'com.google.protobuf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyL
ist()' (com.google.security.zynamics.BinExport$BinExport2 and com.google.protobuf.LazyStringArrayList are
 in unnamed module of loader ghidra.GhidraClassLoader @483bf400) (HeadlessAnalyzer) java.lang.IllegalAcce
ssError: class com.google.security.zynamics.BinExport$BinExport2 tried to access method 'com.google.proto
buf.LazyStringArrayList com.google.protobuf.LazyStringArrayList.emptyList()' (com.google.security.zynamic
s.BinExport$BinExport2 and com.google.protobuf.LazyStringArrayList are in unnamed module of loader ghidra
.GhidraClassLoader @483bf400)                                                                            
        at com.google.security.zynamics.BinExport$BinExport2.<init>(BinExport.java:19352)                
        at com.google.security.zynamics.BinExport$BinExport2.<clinit>(BinExport.java:25089)              
        at com.google.security.binexport.BinExport2Builder.<init>(BinExport2Builder.java:81)             
        at BinExport.export(BinExport.java:99)                                                           
        at BinExport.run(BinExport.java:81)                                                              
        at ghidra.app.script.GhidraScript.executeNormal(GhidraScript.java:405)                           
        at ghidra.app.script.GhidraScript.doExecute(GhidraScript.java:260)                               
        at ghidra.app.script.GhidraScript.execute(GhidraScript.java:238)                                 
        at ghidra.app.util.headless.HeadlessAnalyzer.runScript(HeadlessAnalyzer.java:588)                
        at ghidra.app.util.headless.HeadlessAnalyzer.runScriptsList(HeadlessAnalyzer.java:926)           
        at ghidra.app.util.headless.HeadlessAnalyzer.analyzeProgram(HeadlessAnalyzer.java:1074)          
        at ghidra.app.util.headless.HeadlessAnalyzer.processFileWithImport(HeadlessAnalyzer.java:1563)   
        at ghidra.app.util.headless.HeadlessAnalyzer.processWithLoader(HeadlessAnalyzer.java:1745)       
        at ghidra.app.util.headless.HeadlessAnalyzer.processWithImport(HeadlessAnalyzer.java:1686)       
        at ghidra.app.util.headless.HeadlessAnalyzer.processWithImport(HeadlessAnalyzer.java:1770)       
        at ghidra.app.util.headless.HeadlessAnalyzer$1.processResult(HeadlessAnalyzer.java:335)          
        at ghidra.framework.protocol.ghidra.GhidraURLQuery.doQueryUrl(GhidraURLQuery.java:141)           
        at ghidra.framework.protocol.ghidra.GhidraURLQuery.queryRepositoryUrl(GhidraURLQuery.java:67)    
        at ghidra.app.util.headless.HeadlessAnalyzer.processURL(HeadlessAnalyzer.java:317)               
        at ghidra.app.util.headless.AnalyzeHeadless.launch(AnalyzeHeadless.java:195)                     
        at ghidra.GhidraLauncher.launch(GhidraLauncher.java:81)                                          
        at ghidra.Ghidra.main(Ghidra.java:54)                                                            

I tried to add extension in GUI mode and then use it in headless, it works. It may be related with this issue ?

@bukowa
Copy link

bukowa commented Feb 12, 2025

Do you manipulate these settings in launch.properties?

VMARGS=-Dapplication.settingsdir=
VMARGS=-Dapplication.cachedir=

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants