java.lang.UnsupportedOperationException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Using the following Spring Release : Spring Core 3.0.1 Spring Batch 2.1.1 or 2.0.2 Spring XML 1.5.9 Running the following code taken from the Spring Batch Manual : StaxEventItemReader<CustomerCredit> xmlStaxEventItemReader = new StaxEventItemReader(); Resource resource = new FileSystemResource("c:\\test.xml"); Map aliases = new HashMap(); aliases.put("customer","org.springframework.batch.sample.domain.CustomerCredit"); aliases.put("price","java.math.BigDecimal"); aliases.put("name","java.lang.String"); XStreamMarshaller marshaller = new XStreamMarshaller(); marshaller.setAliases(aliases); xmlStaxEventItemReader.setUnmarshaller(marshaller); xmlStaxEventItemReader.setResource(resource); xmlStaxEventItemReader.setFragmentRootElementName("customer"); xmlStaxEventItemReader.open(new ExecutionContext()); boolean hasNext = true; CustomerCredit credit = null; while (hasNext) { credit = xmlStaxEventItemReader.read(); if (credit == null) { hasNext = false; } else { System.out.println(credit); } Gives the following error : Exception in thread "main" java.lang.UnsupportedOperationException: XStreamMarshaller does not support unmarshalling using SAX XMLReaders at org.springframework.oxm.xstream.XStreamMarshaller.unmarshalSaxReader(XStreamMarshaller.java:460) at org.springframework.oxm.support.AbstractMarshaller.unmarshalSaxSource(AbstractMarshaller.java:341) at org.springframework.oxm.support.AbstractMarshaller.unmarshal(AbstractMarshaller.java:131) at org.springframework.batch.item.xml.StaxEventItemReader.doRead(StaxEventItemReader.java:222) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:85) This wasn't a problem using the same version of Spring Batch together with Spring WS 1.5.9 and Spring Core 2.5.6
    via by Stijn Vranckx,
  • Using the following Spring Release : Spring Core 3.0.1 Spring Batch 2.1.1 or 2.0.2 Spring XML 1.5.9 Running the following code taken from the Spring Batch Manual : StaxEventItemReader<CustomerCredit> xmlStaxEventItemReader = new StaxEventItemReader(); Resource resource = new FileSystemResource("c:\\test.xml"); Map aliases = new HashMap(); aliases.put("customer","org.springframework.batch.sample.domain.CustomerCredit"); aliases.put("price","java.math.BigDecimal"); aliases.put("name","java.lang.String"); XStreamMarshaller marshaller = new XStreamMarshaller(); marshaller.setAliases(aliases); xmlStaxEventItemReader.setUnmarshaller(marshaller); xmlStaxEventItemReader.setResource(resource); xmlStaxEventItemReader.setFragmentRootElementName("customer"); xmlStaxEventItemReader.open(new ExecutionContext()); boolean hasNext = true; CustomerCredit credit = null; while (hasNext) { credit = xmlStaxEventItemReader.read(); if (credit == null) { hasNext = false; } else { System.out.println(credit); } Gives the following error : Exception in thread "main" java.lang.UnsupportedOperationException: XStreamMarshaller does not support unmarshalling using SAX XMLReaders at org.springframework.oxm.xstream.XStreamMarshaller.unmarshalSaxReader(XStreamMarshaller.java:460) at org.springframework.oxm.support.AbstractMarshaller.unmarshalSaxSource(AbstractMarshaller.java:341) at org.springframework.oxm.support.AbstractMarshaller.unmarshal(AbstractMarshaller.java:131) at org.springframework.batch.item.xml.StaxEventItemReader.doRead(StaxEventItemReader.java:222) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:85) This wasn't a problem using the same version of Spring Batch together with Spring WS 1.5.9 and Spring Core 2.5.6
    via by Stijn Vranckx,
  • I'm using Spring Batch 2.1.0.RELEASE with Spring 3.0.1.RELEASE with Jdk 1.5. Test 1 When I use the following environment : . Spring Batch 2.1.0.RELEASE . Spring WS 1.5.9 (modules spring-xml and spring-oxm) . Spring 2.5.6 Everything works fine. Test 2 When I use the following environment : . Spring Batch 2.1.0.RELEASE . Spring 3.1.0.RELEASE . and WITHOUT spring-oxm module from Spring WS (packages spring-xml and spring-oxm have been integrated into Spring since Spring 3). I got the UnsupportedOperationException error when runngin XmlFunctionalTests : Code: java.lang.UnsupportedOperationException: XStreamMarshaller does not support unmarshalling using SAX XMLReaders at org.springframework.oxm.xstream.XStreamMarshaller.unmarshalSaxReader(XStreamMarshaller.java:460) at org.springframework.oxm.support.AbstractMarshaller.unmarshalSaxSource(AbstractMarshaller.java:341) at org.springframework.oxm.support.AbstractMarshaller.unmarshal(AbstractMarshaller.java:131) at org.springframework.batch.item.xml.StaxEventItemReader.doRead(StaxEventItemReader.java:222) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:87) at org.springframework.batch.sample.iosample.AbstractIoSampleTests.getCredits(AbstractIoSampleTests.java:92) at org.springframework.batch.sample.iosample.AbstractIoSampleTests.testUpdateCredit(AbstractIoSampleTests.java:53) Test 3 When I use the following environment : . Spring Batch 2.1.0.RELEASE . Spring 3.1.0.RELEASE . and WITHOUT spring-oxm and spring-xml modules from Spring WS (packages spring-xml and spring-oxm have been integrated into Spring since Spring 3). I got the ClassNotFoundException error when runngin XmlFunctionalTests : Code: java.lang.ClassNotFoundException : org.springframework.xml.transform.StaxSource Diagnosis and possible solution This is due to the fact that Spring 3 renamed the package org.springframework.xml.transform from Spring WS 1.5.9 into org.springframework.util.xml. So you must change the code for StaxEventItemReader and StaxEventItemWriter in order for Spring Batch to work with Spring 3.
    via by cyril vid,
  • I'm using Spring Batch 2.1.0.RELEASE with Spring 3.0.1.RELEASE with Jdk 1.5. Test 1 When I use the following environment : . Spring Batch 2.1.0.RELEASE . Spring WS 1.5.9 (modules spring-xml and spring-oxm) . Spring 2.5.6 Everything works fine. Test 2 When I use the following environment : . Spring Batch 2.1.0.RELEASE . Spring 3.1.0.RELEASE . and WITHOUT spring-oxm module from Spring WS (packages spring-xml and spring-oxm have been integrated into Spring since Spring 3). I got the UnsupportedOperationException error when runngin XmlFunctionalTests : Code: java.lang.UnsupportedOperationException: XStreamMarshaller does not support unmarshalling using SAX XMLReaders at org.springframework.oxm.xstream.XStreamMarshaller.unmarshalSaxReader(XStreamMarshaller.java:460) at org.springframework.oxm.support.AbstractMarshaller.unmarshalSaxSource(AbstractMarshaller.java:341) at org.springframework.oxm.support.AbstractMarshaller.unmarshal(AbstractMarshaller.java:131) at org.springframework.batch.item.xml.StaxEventItemReader.doRead(StaxEventItemReader.java:222) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:87) at org.springframework.batch.sample.iosample.AbstractIoSampleTests.getCredits(AbstractIoSampleTests.java:92) at org.springframework.batch.sample.iosample.AbstractIoSampleTests.testUpdateCredit(AbstractIoSampleTests.java:53) Test 3 When I use the following environment : . Spring Batch 2.1.0.RELEASE . Spring 3.1.0.RELEASE . and WITHOUT spring-oxm and spring-xml modules from Spring WS (packages spring-xml and spring-oxm have been integrated into Spring since Spring 3). I got the ClassNotFoundException error when runngin XmlFunctionalTests : Code: java.lang.ClassNotFoundException : org.springframework.xml.transform.StaxSource Diagnosis and possible solution This is due to the fact that Spring 3 renamed the package org.springframework.xml.transform from Spring WS 1.5.9 into org.springframework.util.xml. So you must change the code for StaxEventItemReader and StaxEventItemWriter in order for Spring Batch to work with Spring 3.
    via by cyril vid,
    • java.lang.UnsupportedOperationException: XStreamMarshaller does not support unmarshalling using SAX XMLReaders at org.springframework.oxm.xstream.XStreamMarshaller.unmarshalSaxReader(XStreamMarshaller.java:460) at org.springframework.oxm.support.AbstractMarshaller.unmarshalSaxSource(AbstractMarshaller.java:341) at org.springframework.oxm.support.AbstractMarshaller.unmarshal(AbstractMarshaller.java:131) at org.springframework.batch.item.xml.StaxEventItemReader.doRead(StaxEventItemReader.java:222) at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.read(AbstractItemCountingItemStreamItemReader.java:85)
    No Bugmate found.