I encountered an error when I tried to meganize a daa file produced using Galaxy. I downloaded the daa file and the megan-map database (Feb2022) file and ran meganizer from the GUI (MEGAN 6.22.0). The program ran the annotation and then wrote the file and right at the end of writing the file it produced the following error:
Execute failed: java.io.IOException: Cannot invoke “String.length()” because “message0” is null
I also downloaded the older megan-map-Oct2019 database file, reran meganizer and got the same error.
I don’t think I’m the only one experiencing this error. Another user posted this message last night:
Hello,
I ran MEGAN on my file.daa produced by diamon. I tried to use both command line and graphic modes.
When I use command line as follow: daa-meganizer --threads 40 -i file_merged.daa -mdb megan-map-Feb2022.db
I got: caught: java.lang.NullPointerException
** at java.base/java.lang.System.arraycopy(Native Method)**
** at java.base/java.io.BufferedOutputStream.write(BufferedOutputStream.java:129)**
** at megan/megan.daa.io.DAAModifier.appendBlocks(DAAModifier.java:139)**
** at megan/megan.daa.io.DAAModifier.appendBlocks(DAAModifier.java:155)**
** at megan/megan.daa.DAAReferencesAnnotator.apply(DAAReferencesAnnotator.java:250)**
** at megan/megan.daa.Meganize.apply(Meganize.java:73)**
** at megan/megan.tools.DAAMeganizer.run(DAAMeganizer.java:269)**
** at megan/megan.tools.DAAMeganizer.main(DAAMeganizer.java:65)**
While when I used the graphic version of MEGAN, I got this error:
IOException: Cannot invoke “String.length()” because “message0” is null Error: Execute failed: java.io.IOException: Cannot invoke “String.length()” because “message0” is null
Can anyone help me?
Cheers,
Valentina
Is this a bug in meganizer. Please help! Many thanks in advance.
-Mike
I’ve fixed the program to stop the message0” is null exception, that won’t fix the underlying cause.
The null pointer exception my be caused by an out of memory issue… Did you allow MEGAN enough memory during installation, say 16GB? If not, try editing the file MEGAN.vmoptions and setting the memory to -Xmx 16G
Thanks for the help. I downloaded the updated version (6.22.1) and tried to meganize a file again and I did not get the message() is null exception. Now it runs the whole meganizer then writes the file and at the very end it produces an error that simply states null. So as you said, the underlying error has not been solved.
Since meganizer appends a column to the original DAA file, I tried opening that and got the error message that the file had not been meganized. So whatever the program did it did not seem to get saved.
I set the memory to 16GB during the install (I had done this previously) and still got the error. The files are pretty big as I had about 9.6 million 150 bp reads but I monitored the task manager and MEGAN never used more than 13GB of memory. It seems like the problem arises right at the end of writing the file. So, what could the underlying issue be? Is it a problem that I ran Diamond on Galaxy (and downloaded the DAA files)?
I hope you can help resolve this issue as I feel like I am so close to being able to explore and visualize my data. I already mapped the classification using Kraken2, but I am hoping that MEGAN will greatly simplify the visualization process.
I have a similar issue. I’ve just downloaded the new version and using db Feb2022. Running as usually my .daa files which was working fine with your old version and I keep getting this message:
Meganizing file: /Applications/-EncycloReference/MG4_S4_L1_R1.daa
Annotating DAA file using FAST mode (accession database and first accession per line)
Error: java.sql.SQLException: Error opening connection
java.sql.SQLException: Error opening connection
Info: Finished meganizing 1 files. ERRORS: 1
I’m going to try to re-install the old version but I see other people have tried this and it’s still not working. Would you be able to assist?
Many thanks, Melissa
p.s. I’m running Mac M1 Pro chip, OS12.2.1. Cannot use older version now of Megan - file says it’s damaged (mac.os 6.11) and 6.18 or 6.16 says it’s too old for Mac OS - because “Apple can’t check for malicious software” so I believe this has fallen apart when I updated to 12.2.1 with your most recent versions…thank you for looking at this when you have the time.
Update: I have found my last version installer and re-installed (macOS 6_21_17) and can now run .daa files successfully!
Thanks for the file. Unfortunately, I was not able to reproduce the problem.
Meganization completed without any issue…
So, I need more details: which OS are you using? How much memory did you give MEGAN (i.e., what is in the file MEGAN.vmoptions).
It would also be help to have all output messages that MEGAN produces…
It looks like MEGAN tries to write a null block to the end of the DAA file and I need to figure out where that is coming from.
Hmm, that’s unfortunate. Interestingly, I have tried to run the meganizer on two different computers. The first was a Dell Inspiron running Windows10, with 16BG RAM. At first I kept the default memory setting (8GB actually set as 8000 megabytes) during installation (MEGAN 6.22.0), but meganizer stalled out in the middle of the annotation step. So I reinstalled it and set the memory to 16GB (16000 megabytes). Meganizer then ran showing the following steps: Init, Annotation, Writing. Right at the end of the writing phase it spit out the original error message in the title of this thread.
While I was waiting for a response on the forum, I unfortunately managed to kill that computer (dumb decision, I’d rather not talk about it)! I got a new machine that is running Windows 11 with 16GB RAM. I installed MEGAN again (MEGAN 6.22.1, also 16000MB) and reran meganizer. It ran through all the steps mentioned above (Init, Annotation, Writing) and right at the end, I got the new error message that simply said null.
These were the only out messages that MEGAN produced as far as I can tell. Both came up in a faint window at the bottom of the screen that disappeared after about 1 minute. I took photos both times if you would like to see them.
I looked in the MEGAN.vmoptions file and it has the following text:
Enter one VM parameter per line
For example, to adjust the maximum memory usage to 512 MB, uncomment the following line:
-Xmx512m
To include another file, uncomment the following line:
-include-options [path to other .vmoption file]
-Xmx16000M
I hope this information helps and let me know if I can provide anything else.
-Mike
So I have to apologize, I realized over the weekend that I was incorrect about MEGAN producing no further output than the null error message. Of course, the message window has a bunch of messages about the process. I reran meganizer and this was what was produced in the messages window:
Thanks for the messages. Unfortunately, nothing immediately obvious there…
As mentioned, I had no problems with your file on my Mac. I tried running the file under Windows 10 using the Parallels virtual machine on my Mac, but was not able to set that up with enough memory. Now I have setup Parallels on a bigger Mac and am now running the program in a debugger under Windows 10. If it fails with the same exception that you encountered then I might be able to figure out what is going on…
I was able to meganize your file using MEGAN CE (and also UE) under Windows 10. So, it is not a Windows-issue per se, but more probably a question of physical memory available on your machine. I emulated a Windows machine with 64 GB of memory and then ran MEGAN with an allowance of 32G.
How much memory does your machine have and how much did you allow MEGAN?
That may very well be the case. My Windows machine only has 16 GB of RAM and I set MEGAN to use 16,000 MB when doing the set up (the vmoptions files lists -Xmx16000M). So, apparently this is not enough memory to run the meganization? If that is the case, is there no hope of being able to meganize on this machine?
If my machine does not have enough memory to complete meganization, I suppose I will need to look into cloud computing options to complete the meganization step. Should be be able to meganize the files this way, would I be able to load the meganized file into MEGAN on my machine or will 16GB of memory also be problematic?
Many thanks for all your efforts to figure out the problem. I truly appreciate your repeated efforts to help out this metagenomics neophyte!
Meganization requires much more memory than then working with the files in MEGAN. So, yes, the best way to go is to meganize files on a server, e.g. using the command line tool daa-meganizer, and then to download the meganized files onto your local machine.
Another option is to run the megan-server program on your server. It can serve files over the web to MEGAN and you can thus work with your meganized DAA files without having to do download them.
Many thanks for all of your efforts to figure out my meganizing problem a couple of weeks ago. I just wanted to give you a quick update. One of my colleagues has a computer with 64GB of RAM (unbeknownst to me at the time). I was able to successfully meganize my files using this machine (running with a max of 32GB RAM usagage)!
Thanks again for your diligent efforts and also for the Diamond/Megan metagenomics pipeline. I am seeing some interesting things in my initial look at the datasets…made possible by your programs.