Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Nondeterministic exception when creating JAXBContext
Nondeterministic exception when creating JAXBContext [message #1489435] Thu, 27 November 2014 11:08 Go to next message
Paweł Englert is currently offline Paweł EnglertFriend
Messages: 8
Registered: November 2014
Junior Member
Hi,

When I start my app I sometimes get this exception:
[java.lang.ClassCastException: org.eclipse.persistence.jaxb.javamodel.reflection.JavaClassImpl cannot be cast to org.eclipse.persistence.jaxb.javamodel.xjc.XJCJavaClassImpl]
  at org.eclipse.persistence.jaxb.JAXBContext$TypeMappingInfoInput.createContextState(JAXBContext.java:1092)
  at org.eclipse.persistence.jaxb.JAXBContext.<init>(JAXBContext.java:189)
  at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:165)
  at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:152)
  at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:112)
  at org.eclipse.persistence.jaxb.JAXBContextFactory.createContext(JAXBContextFactory.java:102)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:247)
  at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:234)
  at javax.xml.bind.ContextFinder.find(ContextFinder.java:390)
  at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:641)
  at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584)


Note that it is nondeterministic , I think that it may depends on sequence order, how perticular classer are loaded. I am using moxy 2.5.2.

Could you advice me how can I debug what is the cause? I have logged classloaders activities but it gives me no clue. I'm able to reproduce this scenario.

Thanks,
Pawel
Re: Nondeterministic exception when creating JAXBContext [message #1498421 is a reply to message #1489435] Thu, 04 December 2014 11:49 Go to previous messageGo to next message
Paweł Englert is currently offline Paweł EnglertFriend
Messages: 8
Registered: November 2014
Junior Member
I think that I found what happened.
We have two services, first is using JAXBContext.newInstance and second is using DynamicJAXBContextFactory.createContextFromXSD methods in their initilization block.

Sometimes it happens that those two services are initialized in pararell which cause race condition. Looks like internal processing is using some static properties which cause this issue.

Is it anywhere recomended to use JAXBContext and DynamicJAXBContextFactory sequentially? Could anyone confirm if this cue is correct?

/many thanks
Pawel

Re: Nondeterministic exception when creating JAXBContext [message #1500239 is a reply to message #1498421] Fri, 05 December 2014 20:22 Go to previous messageGo to next message
Marcel Valovy is currently offline Marcel ValovyFriend
Messages: 2
Registered: March 2014
Junior Member
Hey Pawel,

thanks for submission! I am from EclipseLink development team and will look into this issue on Monday. As soon as I have more information, I will inform you in this thread.

Best Regards
MarcelV
Re: Nondeterministic exception when creating JAXBContext [message #1506147 is a reply to message #1500239] Wed, 10 December 2014 16:14 Go to previous messageGo to next message
Marcel Valovy is currently offline Marcel ValovyFriend
Messages: 2
Registered: March 2014
Junior Member
Hey,

There is no suspicious piece of code in EclipseLink visible at first glance. I will need you to submit a bug at bugs.eclipse.org . Please, also include the tests. If it is non-deterministic, there is a chance that we will not be able to reproduce the problem. But I can assure you that we will try to run it several times. Please, in case it is non-deterministic, give us also some estimated guess on how often does it happen - once per 2 runs, 10 runs, 20 runs?

Best Regards
MarcelV
Re: Nondeterministic exception when creating JAXBContext [message #1524327 is a reply to message #1506147] Tue, 23 December 2014 11:10 Go to previous messageGo to next message
Paweł Englert is currently offline Paweł EnglertFriend
Messages: 8
Registered: November 2014
Junior Member
Sorry I did't get notified about your reply. I will share details ASAP.
Re: Nondeterministic exception when creating JAXBContext [message #1551159 is a reply to message #1524327] Wed, 07 January 2015 12:51 Go to previous message
Paweł Englert is currently offline Paweł EnglertFriend
Messages: 8
Registered: November 2014
Junior Member
I created bug: bugs.eclipse.org/bugs/show_bug.cgi?id=456266
Previous Topic:Moxy JAXB context creation failed
Next Topic:JPA READ_ONLY query uses wrong connection
Goto Forum:
  


Current Time: Wed Apr 24 20:21:45 GMT 2024

Powered by FUDForum. Page generated in 0.02750 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top