Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mzML Parser Class Fails to Initialize #18

Closed
mobiusklein opened this issue Dec 30, 2017 · 5 comments
Closed

mzML Parser Class Fails to Initialize #18

mobiusklein opened this issue Dec 30, 2017 · 5 comments
Labels

Comments

@mobiusklein
Copy link

Attempting to run MS-GF+ under Java 9.0.1 on an mzML file produced by ProteoWizard MSConvert 30.11626 produces the following traceback:

Reading spectra...
Exception in thread "main" java.lang.ExceptionInInitializerError
        at uk.ac.ebi.jmzml.xml.Constants.<clinit>(Constants.java:56)
        at uk.ac.ebi.jmzml.xml.xxindex.MzMLIndexerFactory$MzMlIndexerImpl.<init>(MzMLIndexerFactory.java:82)
        at uk.ac.ebi.jmzml.xml.xxindex.MzMLIndexerFactory$MzMlIndexerImpl.<init>(MzMLIndexerFactory.java:52)
        at uk.ac.ebi.jmzml.xml.xxindex.MzMLIndexerFactory.buildIndex(MzMLIndexerFactory.java:49)
        at uk.ac.ebi.jmzml.xml.io.MzMLUnmarshaller.<init>(MzMLUnmarshaller.java:121)
        at uk.ac.ebi.jmzml.xml.io.MzMLUnmarshaller.<init>(MzMLUnmarshaller.java:100)
        at edu.ucsd.msjava.mzml.MzMLAdapter.<init>(MzMLAdapter.java:27)
        at edu.ucsd.msjava.msutil.SpectraAccessor.getSpecMap(SpectraAccessor.java:38)
        at edu.ucsd.msjava.ui.MSGFPlus.runMSGFPlus(MSGFPlus.java:217)
        at edu.ucsd.msjava.ui.MSGFPlus.runMSGFPlus(MSGFPlus.java:105)
        at edu.ucsd.msjava.ui.MSGFPlus.main(MSGFPlus.java:56)
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.jmzml.MzMLElement.loadProperties(MzMLElement.java:609)
        at uk.ac.ebi.jmzml.MzMLElement.<init>(MzMLElement.java:564)
        at uk.ac.ebi.jmzml.MzMLElement.<clinit>(MzMLElement.java:83)
        ... 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(Unknown Source)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at javax.xml.bind.ContextFinder.safeLoadClass(ContextFinder.java:573)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:239)
        ... 20 more

While search can be performed if I use mzXML instead, when attempting to write the mzIdentML file a similar error:

Writing results...
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:37)
        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:387)
        at edu.ucsd.msjava.ui.MSGFPlus.runMSGFPlus(MSGFPlus.java:105)
        at edu.ucsd.msjava.ui.MSGFPlus.main(MSGFPlus.java:56)
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:1103)
        at uk.ac.ebi.jmzidml.MzIdentMLElement.<init>(MzIdentMLElement.java:990)
        at uk.ac.ebi.jmzidml.MzIdentMLElement.<clinit>(MzIdentMLElement.java:40)
        ... 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(Unknown Source)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
        at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
        at javax.xml.bind.ContextFinder.safeLoadClass(ContextFinder.java:573)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:239)
        ... 20 more

This appears to be resolved by adding --add-modules java.xml.bind to the java command line argument list before the jar file. Am I using an unsupported version of Java or can this be added to the build step to remove the need to specify it at run time?

@FarmGeek4Life
Copy link
Collaborator

This might be an issue with the version of java - I have yet to try running it with Java 9, it is compiled against the Java 6 baseline, and I have always run it under Java 7 and Java 8. Yes, it appears that Java 9 removed some classes that are used by the mzML/mzIdentML reader/writer dependencies used by MS-GF+. Please try running with Java 8 for confirmation.

@mobiusklein
Copy link
Author

mobiusklein commented Jan 5, 2018

Yes, this is an issue of using too new a version of Java. Java 8 seems to work fine.

@FarmGeek4Life
Copy link
Collaborator

I was able to resolve this issue by adding two new dependencies to MS-GF+, as of release v2018.01.30. They are marked as deprecated in Java 9, with plans to remove them in the future in favor of making them separate packages. The --add-modules=java.xml.bind,java.activation JVM option should work for prior releases, but it's more confusing to users.

@glormph
Copy link

glormph commented Nov 25, 2018

Hmm I'm on openJDK 11 with the 2017.07.21 and I get

java -jar --add-modules=java.xml.bind,java.activation  msgf_plus-2017.07.21-1/MSGFPlus.jar
Error occurred during initialization of boot layer
java.lang.module.FindException: Module java.xml.bind not found

Maybe the openJDK is too new?

@FarmGeek4Life
Copy link
Collaborator

A change request removing java.xml.bind from the classes built-in to OpenJDK/Java 11 was accepted (it was deprecated as of OpenJDK/Java 9). This will likely mean that only MS-GF+ v2018.01.30 and newer will work with Java 11. The previous --add-modules=java.xml.bind,java.activation workaround will no longer work because the package does not exist in OpenJDK/Java 11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants