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

NullPointerException #431

Closed
jheinecke opened this issue Nov 8, 2020 · 6 comments
Closed

NullPointerException #431

jheinecke opened this issue Nov 8, 2020 · 6 comments

Comments

@jheinecke
Copy link

I still have NullPointerException when trying to process page 3 of https://imslp.eu/files/imglnks/euimg/f/fb/IMSLP637118-PMLP126416-Vivaldi-Concerto_Grosso_op3_no11_Arr_Klengel-violin_2.pdf (on the other hand, page 2 passes well). I'm well aware of the Tesseract v4 problem, so I use Tesseract 3.04 and the data which go with it (English, French, Italian, German). I cloned the git repository and ran:

/usr/lib/jvm/java-8-openjdk-amd64/bin/java -cp "build/distributions/Audiveris/lib/*" Audiveris

I use the following configuration on Ubuntu 18.04:

INFO  []                      Main 334  | Environment:
- Audiveris:    5.1.1:78dfce31f
- OS:           Linux 5.4.0-52-generic
- Architecture: amd64
- Java VM:      OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
- OCR Engine:   Tesseract OCR, version 3.04.01
INFO  []                      Main 334  | Environment:
- Audiveris:    5.1.1:78dfce31f
- OS:           Linux 5.4.0-52-generic
- Architecture: amd64
- Java VM:      OpenJDK 64-Bit Server VM (build 25.272-b10, mixed mode)
- OCR Engine:   Tesseract OCR, version 3.04.01

processing always terminates with

WARN  [out]                 SheetStub 845  | Error in performing [SCALE, GRID, HEADERS, STEM_SEEDS, BEAMS, LEDGERS, HEADS, STEMS, REDUCTION, CUE_BEAMS, TEXTS, MEASURES, CHORDS, CURVES, SYMBOLS, LINKS, RHYTHMS, PAGE] java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NullPointerException
java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.NullPointerException
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:206)
	at org.audiveris.omr.sheet.SheetStub.doOneStep(SheetStub.java:1111)
	at org.audiveris.omr.sheet.SheetStub.reachStep(SheetStub.java:832)
	at org.audiveris.omr.sheet.Book.reachBookStep(Book.java:1393)
	at org.audiveris.omr.sheet.Book.transcribe(Book.java:1718)
	at org.audiveris.omr.sheet.ui.BookActions$TranscribeBookTask.doInBackground(BookActions.java:2057)
	at org.audiveris.omr.sheet.ui.BookActions$TranscribeBookTask.doInBackground(BookActions.java:2037)
	at javax.swing.SwingWorker$1.call(SwingWorker.java:295)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at javax.swing.SwingWorker.run(SwingWorker.java:334)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
	at org.audiveris.omr.step.AbstractSystemStep.doitPerSystem(AbstractSystemStep.java:221)
	at org.audiveris.omr.step.AbstractSystemStep.doit(AbstractSystemStep.java:101)
	at org.audiveris.omr.step.Step.doit(Step.java:184)
	at org.audiveris.omr.sheet.SheetStub$4.call(SheetStub.java:1101)
	at org.audiveris.omr.sheet.SheetStub$4.call(SheetStub.java:1089)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	... 3 common frames omitted
Caused by: java.lang.NullPointerException: null
	at org.audiveris.omr.sheet.note.ChordsBuilder.dispatchChords(ChordsBuilder.java:386)
	at org.audiveris.omr.sheet.note.ChordsBuilder.buildHeadChords(ChordsBuilder.java:147)
	at org.audiveris.omr.sheet.note.ChordsStep.doSystem(ChordsStep.java:92)
	at org.audiveris.omr.sheet.note.ChordsStep.doSystem(ChordsStep.java:55)
	at org.audiveris.omr.step.AbstractSystemStep$1.call(AbstractSystemStep.java:193)
	at org.audiveris.omr.step.AbstractSystemStep$1.call(AbstractSystemStep.java:176)
	at org.audiveris.omr.step.AbstractSystemStep.doitPerSystem(AbstractSystemStep.java:214)
	... 8 common frames omitted

So I'm stuck and cannot use this great piece of software. Is there a workaround?

@hallvors
Copy link

Hi @jheinecke , I had a null pointer exception with a very similar stack, and looking into it the reason was I had Tesseract 4.x installed and Audiveris is not compatible with 4.x data files.

To fix this, I downloaded the eng, fra and deu files from https://github.com/tesseract-ocr/tessdata/tree/074c37215b01ab8cc47a0e06ff7356383883d775 (the commit for the last tesseract data 3.x) and placed them in a folder named tessdata, then set TESSDATA_PREFIX environment variable to the parent folder of said tessdata. I tested transcribing the PDF you linked to above before and after, and it works with this config.

@jheinecke
Copy link
Author

Hi @hallvors, this is exactly what I did (see my initial posting above), I use tesseract 3.04 (as the log says) but it still crashes. Which Java-version do you use ?

@hallvors
Copy link

Ah, apologies @jheinecke - I should have noticed that. Do you have TESSDATA_PREFIX set to make absolutely sure the Tesseract bundled with Audiveris finds the 3.x data files? I did test your file with and without this setting before commenting, so it still seems like an issue with the Tesseract configuration to me. In any case I happen to use the development branch of Audiveris and Oracle JDK 11 on Ubuntu. (Using the Oracle one because that's what the docs said and I didn't feel too adventurous)

@hbitteur
Copy link
Contributor

@jheinecke
According to your log, the NPE occurs in chords step, which has nothing to do with OCR (and Tesseract).
Since you are on Linux, I'd advise you to use 5.2 alpha version rather than old 5.1.x

You simply need to use the "development" branch rather than the default "master" branch.
So, issue this command once after having cloned Audiveris to your local disk:

git checkout development

Then proceed to build with gradlew as usual.

@hallvors
Copy link

Note that to build development branch you need to use JDK version 11, not 8. I was clearly led astray here by the fact much of this crash stack is in fairly generic code and will probably be similar for many crashes. Apologies again.

@jheinecke
Copy link
Author

Hi,
That was it, I switched to the development branch, run gradlew clean, build and run (and this time with openjdk 11 instead of 8) and it works. Great, thanks a lot for this wonderful tool !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants