This is a test version of Biostars. For the public version, visit https://www.biostars.org.
cramtools Java NoClassDefFoundError

Using cramtools 3.0

The same error was posted in https://github.com/enasequence/cramtools/issues/55

 **cramtools cram -I TEST.bam -R Human_Decoy_REF/hs37d5.fa  -O TEST.bam.cram**

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)
        ... 9 more

Why is this happening ? Would appreciate help.

Thanks !!

cram cramtools

1 answer

From the email conversation with the Vadim Zalunin

1) Use JAVA 8

2) to download latest cramtools jar: wget 'https://github.com/enasequence/cramtools/blob/master/cramtools-3.0.jar?raw=true' -O cramtools-3.0.jar

3) to check version: java -jar cramtools-3.0.jar | grep Version

4) to check if the class is in the jar file: jar tf cramtools-3.0.jar | grep CountingOutputStream

With trying the above it worked for me.

Log in to answer this question.