[jboss-jira] [JBoss JIRA] (WFLY-4027) RESTEasy ViolationReport is not processed by JAXB provider
Harald Wellmann (JIRA)
issues at jboss.org
Thu Nov 6 05:38:30 EST 2014
[ https://issues.jboss.org/browse/WFLY-4027?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Harald Wellmann reopened WFLY-4027:
-----------------------------------
It seems the current solution is only partial. I now do get a marshalled {{ViolationReport}}, but the content is incomplete:
{code:xml}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><violationReport><parameterViolations/></violationReport>
{code}
{{<parameterViolations/>}} should not be empty.
The problem is that {{parameterViolations}} is a list of {{ResteasyConstraintViolation}}. This class has getters but no setters, which should be ok for JAXB since the class is annotated with {{@XmlAccessorType(XmlAccessType.FIELD)}}.
However, the class {{ResteasyConstraintViolation}} is loaded from the module {{org.jboss.resteasy.resteasy-jaxrs}} which does not import {{javax.xml.bind.api}}, so the JAXB marshaller does not detect the {{XmlAccessorType}} annotation since the annotation class was loaded from the wrong class loader.
After adding
{code:xml}
<module name="javax.xml.bind.api"/>
{code}
to the {{org.jboss.resteasy.resteasy-jaxrs}} module, I now do get the correct validation message.
Not knowing too much about RESTeasy and WildFly internals, I'm not fully confident that this is now the final solution - it might be helpful to add a couple of regression tests for marshalled violation reports with different combinations of violations.
> RESTEasy ViolationReport is not processed by JAXB provider
> ----------------------------------------------------------
>
> Key: WFLY-4027
> URL: https://issues.jboss.org/browse/WFLY-4027
> Project: WildFly
> Issue Type: Bug
> Components: REST
> Affects Versions: 8.1.0.Final, 8.2.0.CR1, 9.0.0.Alpha1
> Reporter: Harald Wellmann
> Assignee: Stuart Douglas
> Labels: resteasy, validation
> Fix For: 8.2.0.CR1, 9.0.0.Beta1
>
>
> When used in combination with Bean Validation, RESTEasy should wrap validation errors in a {{ValidationReport}} which should be included in the REST response, marshalled to JSON or XML, depending on the content type.
> This does not work currently in WildFly 8.1.0.Final.
> The issue was reported in RESTEASY-1054. and is marked as fixed in RESTEasy 3.0.9.Final.
> However, I can still reproduce the issue with a local build of WildFly 8.2.0.CR1-SNAPSHOT (from the 8.x branch) which includes RESTEasy 3.0.10.Final.
> Going back to WildFly 8.1.0.Final, the issue no longer occurs when I add
> {code}
> <module name="javax.xml.bind.api"/>
> {code}
> to the {{module.xml}} descriptor of {{org.jboss.resteasy.resteasy-validator-provider-11}}.
> The same fix works for 8.2.0.CR1-SNAPSHOT.
> Looking at the module descriptor, it seems that 9.0.0.Alpha1 is also affected (but I did not test my sample on 9.0.0.Alpha1).
--
This message was sent by Atlassian JIRA
(v6.3.8#6338)
More information about the jboss-jira
mailing list