This one has me stumped. I have a Java String Batch app that runs without any error when run against Java 1.8.0.77. It reads in an XML file and writes it to a DB flawlessly.
After updating to JDK 1.8.0.162 the reader simply does not work and does not send any error messages even with logging set to DEBUG. Changing back to Java 1.8.0.77 resolves the issue. Our servers are running 162 though so I have to make this work in 162.
Here is the reader:
@Bean
ItemReader<Product> reviewItemReader() {
StaxEventItemReader<Product> xmlFileReader = new StaxEventItemReader<>();
xmlFileReader.setResource(new FileSystemResource(this.fileName));
xmlFileReader.setFragmentRootElementName("Product");
Jaxb2Marshaller feedMarshaller = new Jaxb2Marshaller();
feedMarshaller.setClassesToBeBound(Product.class);
xmlFileReader.setUnmarshaller(feedMarshaller);
return xmlFileReader;
}
When I run it against Java 1.0.8.77 I get the full product record and all subclasses back filled in with data from the file. When I run it against Java 1.0.8.162 I only get back the 3 attributes on the product tag and none of the fields inside.
The XML looks something like:
...
<Product id="asdsada" removed="false" disabled="true">
<Descriptoin> Blah blah blah</Descriptoin>
<UPCs>
<UPC> 123423432</UPC>
</UPCs>
<Rating>5</Rating>
<Name>name here</Name>
<Categories>
<Category> Cat 1 </Category>
<Category> Cat 2 </Category>
<Category> Cat 3 </Category>
</Categories>
...
</Product>
<Product id="zxcvzxcvxcv" removed="true" disabled="false">
<Descriptoin> Blah blah blah</Descriptoin>
<UPCs>
<UPC> 123222423432</UPC>
</UPCs>
<Rating>5</Rating>
<Name>name here</Name>
<Categories>
<Category> Cat 1 </Category>
<Category> Cat 2 </Category>
<Category> Cat 3 </Category>
</Categories>
....
</Product>
The product class is something like this
@XmlRootElement(name = "Product", namespace = "FOO POWER")
public class Product {
@XmlAttribute(name = "removed")
public String removed;
@XmlAttribute(name = "disabled")
public String disabled;
@XmlAttribute(name = "id")
public String id;
public String Name;
public String Rating;
public UPCs UPCs;
public Brand Brand;
...
Again, it works without any issue at all in 1.8.0.77. I have run millions of records through it in testing. Those same records fail when run in 1.8.0.162
Someone asked to see what a child class looks like. They are pretty much like this:
public class Brand {
public String Name;
public Attributes Attributes;
public String ExternalId;
public String disabled;
...