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

XStreamMarshaller should avoid direct use of CompositeClassLoader which is not exported by XStream in OSGi #25662

Closed
aclemons opened this issue Aug 30, 2020 · 1 comment
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@aclemons
Copy link

XStreamMarshaller uses the class CompositeClassLoader here, but it is not part of the public API. xstream is an OSGi bundle and does not export the package com.thoughtworks.xstream.core.util. This results in a ClassNotFoundException when using Spring oxm + xstream in an OSGi environment since that package is not exported.

I've asked explicitly here about this. Could Spring oxm use the same classloader which loaded the xstream classes (XStream.class.getClassLoader()) to lookup the CompositeClassLoader and create a new instance to avoid this issue?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 30, 2020
@jhoeller jhoeller self-assigned this Aug 30, 2020
@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 30, 2020
@jhoeller
Copy link
Contributor

Since this is just a default instance for our beanClassLoader field which gets overridden in any common Spring setup anyway (to Spring's context-level ClassLoader as propagated through BeanClassLoaderAware), I see no need to hang on to CompositeClassLoader there. We can simply use ClassUtils.getDefaultClassLoader() as the default value (which will only apply for testing scenarios and other custom use of XStreamMarshaller outside of a Spring container) like we do in other places.

@jhoeller jhoeller added this to the 5.2.9 milestone Aug 30, 2020
@jhoeller jhoeller changed the title XStreamMarshaller uses CompositeClassLoader which is a non-public API XStreamMarshaller uses CompositeClassLoader which is not exported by XStream in OSGi Aug 30, 2020
@jhoeller jhoeller changed the title XStreamMarshaller uses CompositeClassLoader which is not exported by XStream in OSGi XStreamMarshaller should avoid direct use of CompositeClassLoader which is not exported by XStream in OSGi Aug 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants