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

JaxbMarshaller scan should skip annotated interfaces [SPR-13221] #17812

spring-projects-issues opened this issue Jul 11, 2015 · 0 comments


Copy link

@spring-projects-issues spring-projects-issues commented Jul 11, 2015

Kiril Nugmanov opened SPR-13221 and commented

Spring JAXB marshaller (org.springframework.oxm.jaxb.Jaxb2Marshaller) incorrectly scans packages with JAXB annotations.

Problems is when package is being scanned used org.springframework.oxm.jaxb.ClassPathJaxb2TypeScanner which checks if class has following annotations:

  • XmlRootElement
  • XmlType
  • XmlSeeAlso
  • XmlEnum
  • XmlRegistry

So if you generating client from WSDL - webservice interface will have an anotation XmlSeeAlso.

Whis annotatio leads to the error

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in class path resource [application.xml]: Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
org.cynic.test.client.Service is an interface, and JAXB can't handle interfaces.
	this problem is related to the following location:
		at org.cynic.test.client.Service
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
        <property name="packagesToScan" value="org.cynic.test.client"/>

The only dirty fix is to downgrade JAXB binding version from 2.1 to 2.0
For more details why this annotation is being generated on interfaces see this post

Solution should be following: org.springframework.oxm.jaxb.ClassPathJaxb2TypeScanner must ignore annotated interfaces (even if there is default implementation for Java 8)

I can create pull request (after discussion).

Affects: 4.1.7

Referenced from: commits 18c4671

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants