enasequence / cramtools

CRAM format specification and java API for read data.
http://www.ebi.ac.uk/ena/about/cram_toolkit
Apache License 2.0
58 stars 21 forks source link

Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.utils.CountingOutputStream #40

Open btiernay opened 9 years ago

btiernay commented 9 years ago

Getting this exception using the versioned download in v3.0 (https://github.com/enasequence/cramtools/archive/v3.0.tar.gz):

time java \
    -jar "cramtools-3.0/cramtools-3.0.jar" \
    cram \
    --input-bam-file '130551a4-2010-4556-b817-6a295940c8e5/257235f3926b2be84e8a9e80acdfb345.bam' \
    --reference-fasta-file 'genome.fa' \
    --output-cram-file 'test-cramtools-3.0.cram'
Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at net.sf.cram.CramTools.invoke(CramTools.java:91)
    at net.sf.cram.CramTools.main(CramTools.java:121)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/CountingOutputStream
    at htsjdk.samtools.cram.build.CramIO.writeContainerForSamFileHeader(CramIO.java:247)
    at htsjdk.samtools.cram.build.CramIO.writeCramHeader(CramIO.java:161)
    at net.sf.cram.Bam2Cram.main(Bam2Cram.java:405)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.utils.CountingOutputStream
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 9 more
Jack-Lin-DS-AI commented 9 years ago

Getting similar exception using v3.0

java -jar ~/bin/cramtools-3.0/cramtools-3.0.jar bam --input-cram-file HG00096.alt_bwamem_GRCh38DH.20150526.low_coverage.bam.cram --reference-fasta-file /cedar/lin/Data/human/GRCh38_full_analysis_set_plus_decoy_hla.fa --output-bam-file HG00096.alt_bwamem_GRCh38DH.20150526.low_coverage.bam

Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at net.sf.cram.CramTools.invoke(CramTools.java:91) at net.sf.cram.CramTools.main(CramTools.java:121) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/CountingOutputStream at htsjdk.samtools.cram.build.CramIO.readSAMFileHeader(CramIO.java:254) at htsjdk.samtools.cram.build.CramIO.readCramHeader(CramIO.java:191) at net.sf.cram.common.Utils.openCramInputStream(Utils.java:848) at net.sf.cram.Cram2Bam.main(Cram2Bam.java:107) ... 6 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.utils.CountingOutputStream at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 10 more

kaktus42 commented 9 years ago

Here too:

INFO    2015-08-29 15:45:29     FixBAMFileHeader        Confirming reference sequence md5: 1
INFO    2015-08-29 15:45:29     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 2
INFO    2015-08-29 15:45:30     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 3
INFO    2015-08-29 15:45:31     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 4
INFO    2015-08-29 15:45:31     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 5
INFO    2015-08-29 15:45:32     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 6
INFO    2015-08-29 15:45:33     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 7
INFO    2015-08-29 15:45:33     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 8
INFO    2015-08-29 15:45:34     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 9
INFO    2015-08-29 15:45:35     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 10
INFO    2015-08-29 15:45:35     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 11
INFO    2015-08-29 15:45:36     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 12
INFO    2015-08-29 15:45:36     FixBAMFileHeader        Reference sequence MD5 not found, calculating: 999
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:483)
        at net.sf.cram.CramTools.invoke(CramTools.java:91)
        at net.sf.cram.CramTools.main(CramTools.java:121)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/CountingOutputStream
        at htsjdk.samtools.cram.build.CramIO.writeContainerForSamFileHeader(CramIO.java:247)
        at htsjdk.samtools.cram.build.CramIO.writeCramHeader(CramIO.java:161)
        at net.sf.cram.Bam2Cram.main(Bam2Cram.java:405)
        ... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.utils.CountingOutputStream
        at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 9 more

The reference has an index (X.fasta & X.fasta.fai) The bam file is indexed (Y.bam & Y.bam.bai)

$ java -jar cramtools-3.0/cramtools-3.0.jar
Version 3.0-b30
Jeanno commented 9 years ago

Same here.

Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at net.sf.cram.CramTools.invoke(CramTools.java:91) at net.sf.cram.CramTools.main(CramTools.java:121) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/CountingOutputStream at htsjdk.samtools.cram.build.CramIO.readSAMFileHeader(CramIO.java:254) at htsjdk.samtools.cram.build.CramIO.readCramHeader(CramIO.java:191) at net.sf.cram.Cram2Fastq.main(Cram2Fastq.java:90) ... 6 more Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.utils.CountingOutputStream at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 9 more <<<

Jack-Lin-DS-AI commented 9 years ago

I solved the errors by reinstall cramtools from source by following the instruction. Hope it may help you guys. "To build the program from source: To check out the source code from github you will need git client: http://git-scm.com/ Make sure you have java 1.7 or higher: http://openjdk.java.net/ or http://www.oracle.com/us/technologies/java/index.html Make sure you have ant version 1.7 or higher: http://ant.apache.org/ Clone the repository to your local directory: $ git clone https://github.com/enasequence/cramtools.git Change to the directory: $ cd cramtools Build a runnable jar file: $ ant -f build/build.xml runnable Run cramtools $ java -jar cramtools-3.0.jar "

kaktus42 commented 9 years ago

@ChihHsuLin, did not work for me. I also ran the tests without errors.

Jeanno commented 9 years ago

@ChihHsuLin @kaktus42 Thanks a lot. It works for me. Make sure you build the one from git clone instead of release.

vadimzalunin commented 9 years ago

The release tag is missing some dependencies. I've checked in the fixed jar.

tk2 commented 9 years ago

Gah, just got stuck on this too. Any chance you could update the latest release to include the dependencies?

vadimzalunin commented 9 years ago

Did you try the latest jar from the master branch?

tk2 commented 9 years ago

Yes, that worked fine.

vadimzalunin commented 9 years ago

next release is coming, hopefully fixing this issue permanently.

srynobio commented 8 years ago

I'm currently using the latest release and I'm getting the same error.

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at net.sf.cram.CramTools.invoke(CramTools.java:91)
    at net.sf.cram.CramTools.main(CramTools.java:121)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/compress/utils/CountingOutputStream
    at htsjdk.samtools.cram.build.CramIO.writeContainerForSamFileHeader(CramIO.java:247)
    at htsjdk.samtools.cram.build.CramIO.writeCramHeader(CramIO.java:161)
    at net.sf.cram.Bam2Cram.main(Bam2Cram.java:405)
    ... 6 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.compress.utils.CountingOutputStream
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
wangying0128 commented 8 years ago

[root@localhost cramtools]# java -jar cramtools-3.0.jar bam --input-cram-file /usr/snp/cramtools/HG00096.alt_bwamem_GRCh38DH.20150718.GBR.low_coverage.cram --reference-fasta-file /usr/snp/cramtools/GRCh38_full_analysis_set_plus_decoy_hla.fa --skip-md5-check --output-bam-file HG00096.bam Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.sf.cram.CramTools.invoke(CramTools.java:91) at net.sf.cram.CramTools.main(CramTools.java:121) Caused by: java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:3236) at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118) at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93) at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153) at htsjdk.samtools.util.IOUtil.copyStream(IOUtil.java:658) at htsjdk.samtools.cram.io.InputStreamUtils.readFully(InputStreamUtils.java:40) at net.sf.cram.ref.ReferenceSource.loadFromPath(ReferenceSource.java:254) at net.sf.cram.ref.ReferenceSource.findBasesByMD5(ReferenceSource.java:287) at net.sf.cram.ref.ReferenceSource.findBases(ReferenceSource.java:180) at net.sf.cram.ref.ReferenceSource.getReferenceBases(ReferenceSource.java:128) at net.sf.cram.Cram2Bam.main(Cram2Bam.java:220) ... 6 more [root@localhost cramtools]# ls

vadimzalunin commented 8 years ago

@wangying0128 please try with more memory: java -Xmx4g -jar cramtools-3.0.jar bam --input-cram-file /usr/snp/cramtools/HG00096.alt_bwamem_GRCh38DH.20150718.GBR.low_coverage.cram --reference-fasta-file /usr/snp/cramtools/GRCh38_full_analysis_set_plus_decoy_hla.fa --skip-md5-check --output-bam-file HG00096.bam

levipierce commented 8 years ago

I also had the same problem, building from the repo fixed it.

maximilianh commented 8 years ago

Getting the same error. adding more memory did not fix it.

leegent commented 8 years ago

Getting the same error. Cloning from git and building fixed it!

oiiio commented 7 years ago

Because this thread helped >1 year after, I also fixed error by cloning git and building with ant -f build/build.xml runnable