Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

java.lang.ArrayIndexOutOfBoundsException while marshalling with JAXB

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We just started seeing this exception crop up in our production environment.

I've been searching and I have not been able to find a whole lot of information on this error. Can anyone shed some light as to what could be causing this and if possible any steps to correct it?

java.lang.ArrayIndexOutOfBoundsException
at com.sun.xml.internal.bind.v2.util.CollisionCheckStack.pushNocheck(CollisionCheckStack.java:110)
at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.childAsRoot(XMLSerializer.java:475)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(MarshallerImpl.java:314)
at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(MarshallerImpl.java:243)
at javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:87)
at com.ibm.xml.xlxp2.jaxb.marshal.MarshallerProxy.marshal(MarshallerProxy.java:100)
at com.sbc.cctp.easl.crm.jaxb.CrmEaslJaxbUtil.javaObject2Xml(CrmEaslJaxbUtil.java:116)
at com.sbc.cctp.easl.crm.jaxb.EaslCreateCaseImpl.generateCreateCaseRequestXML(EaslCreateCaseImpl.java:71)
at com.sbc.cctp.easl.crm.jaxb.EaslCreateCaseImpl.generateCreateCaseRequestWebServiceXML(EaslCreateCaseImpl.java:48)
at com.sbc.cctp.easl.dao.adapter.ClarifyJmsAdapter.buildCreateCaseRequestXmlMessage(ClarifyJmsAdapter.java:399)
at com.sbc.cctp.easl.dao.adapter.ClarifyJmsAdapter.invoke(ClarifyJmsAdapter.java:113)
at com.sbc.cctp.easl.dao.adapter.AbstractAdapterDispatch.dispatchAdapter(AbstractAdapterDispatch.java:106)
at com.sbc.cctp.easl.dao.work.AdapterDispatchWorkManager.invoke(AdapterDispatchWorkManager.java:24)
at com.sbc.cctp.easl.dao.work.WorkImpl.run(WorkImpl.java:117)
at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:782)
at com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:222)
at com.ibm.ws.asynchbeans.ABWorkItemImpl.run(ABWorkItemImpl.java:159)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563)

the method call


the getMarshaller() method
 
Sheriff
Posts: 26949
83
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My guess: a race condition which occurs when two threads try to do marshalling at the same time.

True, the code you posted looks like it should be thread-safe. But it's possible that it's running into non-thread-safe situations deep down in the system code which you see at the top of your stack trace.

Or perhaps "JAXBContext.newInstance(CRM_TYPE)" isn't a thread-safe operation and it can return the same object to two different threads. Problems with that theory: I don't know whether that would matter, and the API documentation doesn't mention that as a problem.

Unfortunately that's just speculation, and it isn't clear what you could do to fix it, or how to test that the fix worked. Perhaps somebody else will have a more useful answer...
 
Ranch Hand
Posts: 733
7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I concur in view of

at com.ibm.ws.asynchbeans.ABWorkItemImpl.run(ABWorkItemImpl.java:159)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1563)



If you are using schema compilation to establish the (pojo) object graph, you should be aware that there is a switch to make out synchronized methods, namely, adding the switch:

-Xsync-methods


The effect of which is basically making all the accessors synchronized (by adding the keyword synchronized to their declaration).

In the meantime as a stop-gap measure, maybe you could try add a lock see if it could achieve the desired effect without making a full analysis?
 
John Foley
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for replying. I'll implement this and see how it does.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic