简体   繁体   English

线程“main”中的异常java.lang.ExceptionInInitializerError引起:javax.xml.bind.DataBindingException:javax.xml.bind.JAXBException

[英]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.

相关问题 javax.xml.bind.JAXBException 与 Java 11 - javax.xml.bind.JAXBException with Java 11 线程“主”中的异常javax.xml.bind.JAXBException:此上下文已知类或其任何超类 - Exception in thread “main” javax.xml.bind.JAXBException: class nor any of its super class is known to this context 如何解决“主线程中的异常 java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException” - How to solve " Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException" 实例化休眠配置会引发错误:线程“ main”中的异常java.lang.NoClassDefFoundError:javax / xml / bind / JAXBException - Instantiating a hibernate Configuration throws error: Exception in thread “main” java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException ClassNotFoundException:javax.xml.bind.JAXBException(再次) - ClassNotFoundException: javax.xml.bind.JAXBException (again) 如何解决由:java.lang.ClassNotFoundException:javax.xml.bind.JAXBException迁移到Java 11(Openjdk-11.0.1) - how to solve Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException migrating to Java 11(Openjdk-11.0.1 ) javax.xml.bind.JAXBException Hibernate Java 10 - javax.xml.bind.JAXBException Hibernate Java 10 java.lang.ClassNotFoundException:运行python代码时出现javax.xml.bind.JAXBException - java.lang.ClassNotFoundException: javax.xml.bind.JAXBException while running python code javax.ws.rs.WebApplicationException:javax.xml.bind.JAXBException,具有链接的异常类[Ljava.lang.Object; - javax.ws.rs.WebApplicationException: javax.xml.bind.JAXBException with linked exception class [Ljava.lang.Object; javax.xml.bind.JAXBException [java.lang.ClassNotFoundException: com.sun.xmldk.bind.52Factory] - javax.xml.bind.JAXBException [java.lang.ClassNotFoundException: com.sun.xml.bind.v2.ContextFactory] in jdk1.5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM