[英]Exception in thread “main” java.lang.ExceptionInInitializerError Caused by: javax.xml.bind.DataBindingException: javax.xml.bind.JAXBException
Apologies if my question isn't in the right format or is missing info. 如果我的问题格式不正确或缺少信息,请道歉。 Please let me know and I'll edit as needed. 请告诉我,我会根据需要进行编辑。
I'm a biologist trying to use a java tool for analyzing data ( https://omics.pnl.gov/software/ms-gf ). 我是一名试图使用java工具分析数据的生物学家( https://omics.pnl.gov/software/ms-gf )。 I have no experience programming in java. 我没有使用java编程的经验。 I run the program with the following command: 我用以下命令运行程序:
java -classpath /path/to/MSGFPlus.jar -Xmx3500M -jar /path/to/MSGFPlus.jar -s /path/to/datafile1 -d /path/to/datafile2
The program runs but fails at the final stage, and produces the error below. 程序运行但在最后阶段失败,并产生以下错误。 From googling I found this explanation: "the Exception in thread "main" java.lang.NoClassDefFoundError: means, that the class which you are trying to run was not found in the classpath. Solution: you need to add the class or .jar file which contains this class into the java classpath." 从谷歌搜索我发现这个解释:“线程中的异常”主“java.lang.NoClassDefFoundError:意味着,在类路径中找不到您尝试运行的类。解决方案:您需要添加类或.jar包含此类的文件到java类路径中。“
I followed the advice and added the jar file to the classpath using both export CLASSPATH="/path/to/MSGFPlus.jar"
and by declaring it in the java call above. 我按照建议将jar文件添加到类路径中,使用export CLASSPATH="/path/to/MSGFPlus.jar"
并在上面的java调用中声明它。 Neither fixed the error. 既没有修复错误。
Any insight into how I can fix this? 有关如何解决此问题的任何见解?
Exception in thread "main" java.lang.ExceptionInInitializerError
at uk.ac.ebi.jmzidml.model.utils.ModelConstants.<clinit>(ModelConstants.java:50)
at uk.ac.ebi.jmzidml.xml.jaxb.marshaller.MarshallerFactory.initializeMarshaller(MarshallerFactory.java:35)
at uk.ac.ebi.jmzidml.xml.io.MzIdentMLMarshaller.marshal(MzIdentMLMarshaller.java:100)
at uk.ac.ebi.jmzidml.xml.io.MzIdentMLMarshaller.marshal(MzIdentMLMarshaller.java:91)
at edu.ucsd.msjava.mzid.MZIdentMLGen.writeResults(MZIdentMLGen.java:143)
at edu.ucsd.msjava.mzid.MZIdentMLGen.writeResultsOriginal(MZIdentMLGen.java:130)
at edu.ucsd.msjava.mzid.MZIdentMLGen.writeResultsCleanerTempFile(MZIdentMLGen.java:214)
at edu.ucsd.msjava.mzid.MZIdentMLGen.writeResults(MZIdentMLGen.java:113)
at edu.ucsd.msjava.ui.MSGFPlus.runMSGFPlus(MSGFPlus.java:399)
at edu.ucsd.msjava.ui.MSGFPlus.runMSGFPlus(MSGFPlus.java:106)
at edu.ucsd.msjava.ui.MSGFPlus.main(MSGFPlus.java:57)
Caused by: javax.xml.bind.DataBindingException: javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
at javax.xml.bind.JAXB.unmarshal(JAXB.java:186)
at uk.ac.ebi.jmzidml.MzIdentMLElement.loadProperties(MzIdentMLElement.java:1102)
at uk.ac.ebi.jmzidml.MzIdentMLElement.<init>(MzIdentMLElement.java:989)
at uk.ac.ebi.jmzidml.MzIdentMLElement.<clinit>(MzIdentMLElement.java:39)
... 11 more
Caused by: javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:241)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:455)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:652)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:599)
at javax.xml.bind.JAXB$Cache.<init>(JAXB.java:127)
at javax.xml.bind.JAXB.getContext(JAXB.java:154)
at javax.xml.bind.JAXB.unmarshal(JAXB.java:183)
... 14 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:190)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:499)
at javax.xml.bind.ContextFinder.safeLoadClass(ContextFinder.java:573)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:239)
... 20 more
Surprisingly, I managed to fix it! 令人惊讶的是,我设法解决了它!
For anyone encountering the same problem, the solution was to follow the advice here How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9 . 对于遇到相同问题的任何人,解决方案是遵循这里的建议如何在Java 9中解决java.lang.NoClassDefFoundError:javax / xml / bind / JAXBException 。 Specifically, adding --add-modules java.xml.bind
. 具体来说,添加--add-modules java.xml.bind
。
The final call that ended up working was 结束工作的最后一个电话是
java --add-modules java.xml.bind -classpath /path/to/MSGFPlus.jar -Xmx3500M -jar /path/to/MSGFPlus.jar -s /path/to/datafile1 -d /path/to/datafile2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.