java.lang.ArrayIndexOutOfBoundsException: -1
at com.sun.xml.bind.v2.util.CollisionCheckStack.pushNocheck(CollisionCheckStack.java:121)
at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:487)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315)
at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:116)
at weixin.popular.util.XMLConverUtil.convertToXML(XMLConverUtil.java:127)
at weixin.popular.api.PayMchAPI.payUnifiedorder(PayMchAPI.java:153)
Create JAXBContext is very expensive operation and JAXBContext is thread safe. Create marshaller/unmarshaller is very light operation and costs almost nothing comparing to JAXBConetxt.
version 2.8.22
java.lang.ArrayIndexOutOfBoundsException: -1 at com.sun.xml.bind.v2.util.CollisionCheckStack.pushNocheck(CollisionCheckStack.java:121) at com.sun.xml.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:487) at com.sun.xml.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:315) at com.sun.xml.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:244) at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:116) at weixin.popular.util.XMLConverUtil.convertToXML(XMLConverUtil.java:127) at weixin.popular.api.PayMchAPI.payUnifiedorder(PayMchAPI.java:153)
在 XmlConvertUtils 里 缓存Marshaller, Unmarshaller, 提供复用, 在多线程情况下会出问题, 并导致后续所有的 marshal 都报同样的异常。
Create JAXBContext is very expensive operation and JAXBContext is thread safe. Create marshaller/unmarshaller is very light operation and costs almost nothing comparing to JAXBConetxt.