我的代碼中最近出現了以下問題。環境是:AIX/IBM上的cxf,jaxb Java - CollisionCheckStack問題
的Java(TM)SE運行時環境(建pap6470sr1-20120330_01(SR1))
IBM J9 VM(版本2.6,JRE 1.7.0 AIX ppc64-64 20120322_106209(JIT啓用,啓用AOT ))
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)
此代碼工作正常Linux服務器上使用Oracle的Java 1.7。它還使用IBM Java 1.6在AIX上工作。但是在使用IBM Java 1.7時會引發這些異常。 我做的com.sun.xml.bind.v2.util.CollisionCheckStack.findDuplicate(CollisionCheckStack.java:133)
研究,發現了一些外觀類似的問題/答案,如:
http://mydevtoolbox.blogspot.com/2013/07/jaxb-marshaller-no-threadsafe-error.html,其中建議「創建編組器和每個請求的Unmarshaller」
我不明確使用的Marshaller/Unmarshaller的 - 它看起來像Java 1.7上的CXF/JAXB問題。
任何想法,見解,意見,非常感謝。
首先,這是一個很低層次的方式。我爲所有這些任務使用CXF框架。這是一項業務需求。其次,我不確定這可以成爲解決方案。 – 2014-11-04 13:41:55
@YuryNebieridze正如我所說,只是一種解決方法。這對我來說看起來像一個古怪的JAXB錯誤,請檢查IBM Java 1.7中使用的JAXB版本。 – lexicore 2014-11-04 13:53:03
是的,我瞭解解決方法。我確切地知道Java 7使用JAXB RI 2.2而不是基於JAXB RI 2.1的Java 6--下面是一個圖表:https://jaxb.java.net/guide/Which_JAXB_RI_is_included_in_which_JDK_.html。關鍵是,該代碼可以在Linux上使用Oracle Java 7。 – 2014-11-04 14:33:09