javax.xml.bind.UnmarshalException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

You created JAXBContext with wrong parametes. See http://blog.bdoughan.com/2012/07/jaxb-and-root-elements.html

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • We've been using Mediashelf client APIs in our repository. All methods we use are working properly except listDatastreams, which throws an exception as attached below. The test code I'm using is: ... ListDatastreamsResponse response = listDatastreams("york:3").execute(client); for(DatastreamType dst: response.getDatastreams()) { System.out.println(dst.getDsid()); } Thanks, Frank Digital Library Systems Developer The University of York ------------------------------------------------------ P.S. The error message is: Tests run: 3, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.45 sec <<< FAILURE! testListDatastreams(uk.ac.york.dlib.yodl.utils.fedora.ds.TestMediaShelfFedoraClient) Time elapsed: 0.193 sec <<< ERROR! com.yourmediashelf.fedora.client.FedoraClientException: unexpected element (uri:"", local:"objectDatastreams"). Expected elements are <{http://www.fedora.info/definitions/1/0/access/}OAI-delimiter>,<{http://www.fedora.info/definitions/1/0/access/}OAI-namespaceIdentifier>,<{http://www.fedora.info/definitions/1/0/access/}OAI-sample>,<{http://www.fedora.info/definitions/1/0/access/}PID-delimiter>,<{http://www.fedora.info/definitions/1/0/access/}PID-namespaceIdentifier>,<{http://www.fedora.info/definitions/1/0/access/}PID-sample>,<{http://www.fedora.info/definitions/1/0/access/}adminEmail>,<{http://www.fedora.info/definitions/1/0/access/}fedoraObjectHistory>,<{http://www.fedora.info/definitions/1/0/access/}fedoraRepository>,<{http://www.fedora.info/definitions/1/0/access/}objCreateDate>,<{http://www.fedora.info/definitions/1/0/access/}objDissIndexViewURL>,<{http://www.fedora.info/definitions/1/0/access/}objItemIndexViewURL>,<{http://www.fedora.info/definitions/1/0/access/}objLabel>,<{http://www.fedora.info/definitions/1/0/access/}objLastModDate>,<{http://www.fedora.info/definitions/1/0/access/}objModels>,<{http://www.fedora.info/definitions/1/0/access/}objOwnerId>,<{http://www.fedora.info/definitions/1/0/access/}objState>,<{http://www.fedora.info/definitions/1/0/access/}objectDatastreams>,<{http://www.fedora.info/definitions/1/0/access/}objectMethods>,<{http://www.fedora.info/definitions/1/0/access/}objectProfile>,<{http://www.fedora.info/definitions/1/0/access/}repositoryBaseURL>,<{http://www.fedora.info/definitions/1/0/access/}repositoryName>,<{http://www.fedora.info/definitions/1/0/access/}repositoryOAI-identifier>,<{http://www.fedora.info/definitions/1/0/access/}repositoryPID>,<{http://www.fedora.info/definitions/1/0/access/}repositoryVersion>,<{http://www.fedora.info/definitions/1/0/access/}retainPID>,<{http://www.fedora.info/definitions/1/0/access/}sampleAccess-URL>,<{http://www.fedora.info/definitions/1/0/access/}sampleOAI-URL>,<{http://www.fedora.info/definitions/1/0/access/}sampleSearch-URL> at com.yourmediashelf.fedora.client.response.ListDatastreamsResponse.getObjectDatastreams(ListDatastreamsResponse.java:105) at com.yourmediashelf.fedora.client.response.ListDatastreamsResponse.getDatastreams(ListDatastreamsResponse.java:63) at uk.ac.york.dlib.yodl.utils.fedora.ds.TestMediaShelfFedoraClient.testListDatastreams(TestMediaShelfFedoraClient.java:109) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.runners.ParentRunner.run(ParentRunner.java:236) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) Caused by: javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"objectDatastreams"). Expected elements are <{http://www.fedora.info/definitions/1/0/access/}OAI-delimiter>,<{http://www.fedora.info/definitions/1/0/access/}OAI-namespaceIdentifier>,<{http://www.fedora.info/definitions/1/0/access/}OAI-sample>,<{http://www.fedora.info/definitions/1/0/access/}PID-delimiter>,<{http://www.fedora.info/definitions/1/0/access/}PID-namespaceIdentifier>,<{http://www.fedora.info/definitions/1/0/access/}PID-sample>,<{http://www.fedora.info/definitions/1/0/access/}adminEmail>,<{http://www.fedora.info/definitions/1/0/access/}fedoraObjectHistory>,<{http://www.fedora.info/definitions/1/0/access/}fedoraRepository>,<{http://www.fedora.info/definitions/1/0/access/}objCreateDate>,<{http://www.fedora.info/definitions/1/0/access/}objDissIndexViewURL>,<{http://www.fedora.info/definitions/1/0/access/}objItemIndexViewURL>,<{http://www.fedora.info/definitions/1/0/access/}objLabel>,<{http://www.fedora.info/definitions/1/0/access/}objLastModDate>,<{http://www.fedora.info/definitions/1/0/access/}objModels>,<{http://www.fedora.info/definitions/1/0/access/}objOwnerId>,<{http://www.fedora.info/definitions/1/0/access/}objState>,<{http://www.fedora.info/definitions/1/0/access/}objectDatastreams>,<{http://www.fedora.info/definitions/1/0/access/}objectMethods>,<{http://www.fedora.info/definitions/1/0/access/}objectProfile>,<{http://www.fedora.info/definitions/1/0/access/}repositoryBaseURL>,<{http://www.fedora.info/definitions/1/0/access/}repositoryName>,<{http://www.fedora.info/definitions/1/0/access/}repositoryOAI-identifier>,<{http://www.fedora.info/definitions/1/0/access/}repositoryPID>,<{http://www.fedora.info/definitions/1/0/access/}repositoryVersion>,<{http://www.fedora.info/definitions/1/0/access/}retainPID>,<{http://www.fedora.info/definitions/1/0/access/}sampleAccess-URL>,<{http://www.fedora.info/definitions/1/0/access/}sampleOAI-URL>,<{http://www.fedora.info/definitions/1/0/access/}sampleSearch-URL> at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:631) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:236) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:231) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:105) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1038) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:467) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:448) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:137) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:200) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:173) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137) at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:194) at com.yourmediashelf.fedora.client.response.ListDatastreamsResponse.getObjectDatastreams(ListDatastreamsResponse.java:101) ... 30 more
    via by Frank Feng,
    • javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"kobalt-settings"). Expected elements are <{}kobaltSettings> at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:726) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:247) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:242) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:109) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(UnmarshallingContext.java:1131) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:556) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:153)

    Users with the same issue

    Unknown visitor1 times, last one,
    treefolk
    14 times, last one,
    empt-ak
    1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    17 more bugmates