cxf, jaxb on the AIX / IBM Java problem - CollisionCheckStack

advertisements

I had the following issue recently in my code. The environment is:

Java(TM) SE Runtime Environment (build pap6470sr1-20120330_01(SR1))

IBM J9 VM (build 2.6, JRE 1.7.0 AIX ppc64-64 20120322_106209 (JIT enabled, AOT enabled))

J9VM - R26_Java726_SR1_20120322_1720_B106209

Throwable occurred: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: -14
    at com.sun.xml.bind.v2.util.CollisionCheckStack.findDuplicate(CollisionCheckStack.java:133)
    at com.sun.xml.bind.v2.util.CollisionCheckStack.push(CollisionCheckStack.java:71)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTypeRef(XmlSchemaGenerator.java:705)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$1900(XmlSchemaGenerator.java:429)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace$ElementWithType.writeTo(XmlSchemaGenerator.java:1273)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.writeTo(XmlSchemaGenerator.java:583)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator$Namespace.access$600(XmlSchemaGenerator.java:429)
    at com.sun.xml.bind.v2.schemagen.XmlSchemaGenerator.write(XmlSchemaGenerator.java:411)
    at com.sun.xml.bind.v2.runtime.JAXBContextImpl.generateSchema(JAXBContextImpl.java:755)
    at org.apache.cxf.jaxb.JAXBUtils.generateJaxbSchemas(JAXBUtils.java:760)
    at org.apache.cxf.jaxb.JAXBDataBinding.generateJaxbSchemas(JAXBDataBinding.java:447)
    at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:374)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:429)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:637)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:492)
    at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:240)
    at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:180)
    at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:99)
    at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:51)
    at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:102)
    at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:121)
    at org.apache.cxf.jaxws.ServiceImpl.createPort(ServiceImpl.java:458)
    at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:330)
    at org.apache.cxf.jaxws.ServiceImpl.getPort(ServiceImpl.java:317)
    at javax.xml.ws.Service.getPort(Service.java:130)

This code worked fine on Linux server with Oracle Java 1.7. It also worked on AIX with IBM Java 1.6. But it throws these exceptions when using IBM Java 1.7. I did a research of com.sun.xml.bind.v2.util.CollisionCheckStack.findDuplicate(CollisionCheckStack.java:133) And found some looking similar issues/answers, such as:

http://mydevtoolbox.blogspot.com/2013/07/jaxb-marshaller-no-threadsafe-error.html, which recommends “Create a Marshaller and Unmarshaller per request”

I don’t explicitly use Marshaller/Unmarshaller – it looks like CXF/JAXB issue on Java 1.7.

Any thoughts, insights, opinions are greatly appreciated.


This is not "real" answer, just a workaround suggestion.

The stack trace indicates you have a problem with schema generation. Maybe you could overcome this by providing an XML Schema explicitly using @XmlSchema.location. You'd have to generate and make this schema available manually. Not so cool, but if everything else fails...