Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ContextFinder always load the JAXBContext from jaxb-runtime 2.3.3 #1466

Closed
jimma opened this issue Aug 6, 2020 · 2 comments · Fixed by #1514
Closed

ContextFinder always load the JAXBContext from jaxb-runtime 2.3.3 #1466

jimma opened this issue Aug 6, 2020 · 2 comments · Fixed by #1514

Comments

@jimma
Copy link
Contributor

jimma commented Aug 6, 2020

After upgrading to jaxb-runtime 2.3.3, there is a new created provider file /META-INF/services/javax.xml.bind.JAXBContextFactory
to load and create JAXBContext implementation, and this provider file doesn't exist in previous version like jaxb-runtime-2.3.2 . ContextFinder follows this order to discover the service implementation:

1. Provider of javax.xml.bind.JAXBContextFactory is loaded using the service-provider loading facilities, as defined by Java SE Platform, to attempt to locate and load an implementation of the service. 
2 . Look for resource /META-INF/services/javax.xml.bind.JAXBContext. If such a resource exists, its content is assumed to be the provider factory class.

As a consequence of this order, The JAXBContex from jaxb-runtime 2.3.3 will be always loaded if there is jaxb-runtime 2.3.3 under server's common lib and jaxb-runtime 2.3.2 lib under /WEB-INF/lib. For the servlet container , load class with this order like what Tomcat does won't work anymore :

  • Bootstrap classes of your JVM
  • ./WEB-INF/classes of your web application
  • ./WEB-INF/lib/*.jar of your web application
  • System class loader classes
  • Common class loader classes (server common lib)
@lukasj
Copy link
Member

lukasj commented Feb 19, 2021

I believe #1514 here together with jakartaee/jaxb-api#177 and jakartaee/jaxb-api#176 on the API side are going to resolve this problem.

lukasj added a commit to lukasj/jaxb-ri that referenced this issue Feb 19, 2021
lukasj added a commit that referenced this issue Feb 19, 2021
 #1466: ContextFinder always load the JAXBContext from jaxb-runtime 2.3.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants