OryxProject / oryx

Oryx 2: Lambda architecture on Apache Spark, Apache Kafka for real-time large scale machine learning

Home Page:http://oryx.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArrayIndexOutOfBoundsException from JAXB when serializing ALS model

srowen opened this issue · comments

Strange JAXB exception when serializing a bunch of model IDs in ALS:

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 163
        at com.sun.xml.bind.v2.runtime.output.Encoded.setEscape(Encoded.java:151)
        at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.doText(UTF8XmlOutput.java:321)
        at com.sun.xml.bind.v2.runtime.output.UTF8XmlOutput.text(UTF8XmlOutput.java:305)
        at com.sun.xml.bind.v2.runtime.output.IndentingUTF8XmlOutput.text(IndentingUTF8XmlOutput.java:157)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.text(XMLSerializer.java:406)
        at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.serializeListBody(ArrayReferenceNodeProperty.java:110)
        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:159)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:361)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsXsiType(XMLSerializer.java:696)
        at com.sun.xml.bind.v2.runtime.property.ArrayElementNodeProperty.serializeItem(ArrayElementNodeProperty.java:69)
        at com.sun.xml.bind.v2.runtime.property.ArrayElementProperty.serializeListBody(ArrayElementProperty.java:172)
        at com.sun.xml.bind.v2.runtime.property.ArrayERProperty.serializeBody(ArrayERProperty.java:159)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeBody(ClassBeanInfoImpl.java:361)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsSoleContent(XMLSerializer.java:593)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.serializeRoot(ClassBeanInfoImpl.java:342)
        at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:494)
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:323)
        at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:251)
        at oryx.org.jpmml.model.JAXBUtil.marshal(JAXBUtil.java:102)
        at oryx.org.jpmml.model.JAXBUtil.marshalPMML(JAXBUtil.java:90)
        at com.cloudera.oryx.common.pmml.PMMLUtils.write(PMMLUtils.java:79)
        at com.cloudera.oryx.ml.MLUpdate.buildAndEval(MLUpdate.java:320)
...

Villu notes that this can be resolved by using MOXy instead of the default JAXB. impl More on this to come.

With this change, you can enable MOXy to work around this with -Djavax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory