snippy icon indicating copy to clipboard operation
snippy copied to clipboard

Exception in thread "main" java.lang.UnsupportedClassVersionError

Open wangyuan1234 opened this issue 2 years ago • 10 comments

when i train snippy using the data offered by author, snippy --outdir mut1 --ref example.gbk --ctgs example.fna I have the following problem: Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: org/snpeff/SnpEff has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:757) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:419) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:352) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

I check my snippy version:snippy 4.6.0 java version: java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

I'm new to the command line, has anyone else had a similar problem, please help me

wangyuan1234 avatar Mar 10 '22 07:03 wangyuan1234

Hi. Just to say that I've also received this error today. I know it used to work fine with snippy 4.6.0 using java 1.8.0_231, but not sure how to resolve it I'm afraid.

sthifx avatar Mar 10 '22 16:03 sthifx

I suspect that there is a problem with snpEff, so I found on the snpEff homepage that it requires a version of Java 12, I installed Java 12 and changed the environment variable to Java 12, but the problem still exists. (snippy) zde 09:35:05 ~ $ export PATH=/home/zde/jdk-12.0.2/bin:$PATH (snippy) zde 09:36:10 ~ $ java -version java version "12.0.2" 2019-07-16 Java(TM) SE Runtime Environment (build 12.0.2+10) Java HotSpot(TM) 64-Bit Server VM (build 12.0.2+10, mixed mode, sharing) (snippy) zde 09:36:21 ~ $ snpEff Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: org/snpeff/SnpEff has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:757) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:473) at java.net.URLClassLoader.access$100(URLClassLoader.java:74) at java.net.URLClassLoader$1.run(URLClassLoader.java:369) at java.net.URLClassLoader$1.run(URLClassLoader.java:363) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:362) at java.lang.ClassLoader.loadClass(ClassLoader.java:419) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352) at java.lang.ClassLoader.loadClass(ClassLoader.java:352) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)

wangyuan1234 avatar Mar 11 '22 01:03 wangyuan1234

snpEff=5 indeed requires Java 12 but does not seem to communicate this to conda. Pinning snpEff to the minimal required version for snippy does the trick for me: mamba create -n snippy snippy=4.6 snpeff=4.3 One might test which version of snpEff is the highest compatible with snippy's requirement for openjdk=8.0.312 but for now, above solution is avoiding the issue.

HBrendy avatar Mar 17 '22 11:03 HBrendy

Thank you very much for your help, I solved this problem

wangyuan1234 avatar Mar 17 '22 12:03 wangyuan1234

Hi, I installed snippy using the following command but it is still showing an error. However, bcftools is installed with snippy in the conda env.

mamba create -n snippy snippy=4.6 snpeff=4.3 error----- Need bcftools --version >= 1.7 but you have 0 - please upgrade it.

sekhwal avatar Mar 30 '22 01:03 sekhwal

Try version 5.0 of snpeff instead:

 mamba create --name snippy snippy snpeff==5.0

For using the latest version of snpEff it looks like Java 12 is not available in conda yet (the openjdk package only goes up to Java 11).

apetkau avatar Mar 30 '22 14:03 apetkau

Thank you for the suggestion.

After installing snippy using mamba it shows "bcftools not installed", but bcftools v1.15 is installed automatically by snippy. mamba create --name snippy snippy snpeff==5.0

So, I did remove bcftools from the current conda environment. conda remove bcftools (It will remove snippy also)

Then, reinstall snippy v4.6.0 with bcftools v1.10 in the current conda env. Finally, it works. snippy --check

Thanks again!

sekhwal avatar Mar 30 '22 15:03 sekhwal

Hello, I would like to ask why the error is still displayed after I put snpeff=5.0

snpEff build -c reference/snpeff.config -dataDir . -gff3 ref WARNING: All frames are zero! This seems rather odd, please check that 'frame' information in your 'genes' file is accurate.

bwa mem -Y -M -R '@RG\tID:mut1\tSM:mut1' -t 8 reference/ref.fa fake_reads.fq | samclip --max 10 --ref reference/ref.fa.fai | samtools sort -n -l 0 -T /tmp --threads 3 -m 2000M | samtools fixmate -m --threads 3 - - | samtools sort -l 0 -T /tmp --threads 3 -m 2000M | samtools markdup -T /tmp --threads 3 -r -s - - > snps.bam

[markdup] error reading header

Thank you very much for your help

zhichusun avatar Apr 03 '22 07:04 zhichusun

Hi, Did you figure out the issue?

sekhwal avatar Apr 15 '22 01:04 sekhwal

I found that the default memory for the program to run is too large, and my virtual machine memory is not enough. The running code can be changed to this snippy --cpu 1 --outdir mut1 --ref 1.gb --ctgs 1.fasta --ram 1

zhichusun avatar Apr 15 '22 06:04 zhichusun