[
https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698091#action_12698091
]
VividApp On Software commented on CXF-2168:
-------------------------------------------
Hi Sergev.
I tried as you said , i.e. "depend on cxf-rt-frontend-jaxrs and exclude all the
jaxb dependencies (com.sun.xml.bind group) which it's pulling in and also
depend on cxf-rt-databinding-jaxb instead"
It seems cxf-rt-databinding-jaxb also pulls in the com.sun.xml.bind group.
ie. See the mvn dependency:tree output at the bottom.
I tried excluding the com.sun.xml.bind group from cxf-rt-databinding-jaxb also,
but got other errors as follows:
Here's the mvn:dependency tree when I exclude com.sun.xml.bind group from
cxf-rt-frontend-jaxrs but not cxf-rt-databinding-jaxb, Note that
cxf-rt-databinding-jaxb is pulling in sun jaxb anyway,
a...@alan1 /cygdrive/c/dev/workspaces/webaudit/services-remote
$ mvn dependency:tree
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'dependency'.
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - auditor:services-remote:jar:0.0.1-SNAPSHOT
[INFO] task-segment: [dependency:tree]
[INFO] ------------------------------------------------------------------------
[INFO] [dependency:tree]
[INFO] auditor:services-remote:jar:0.0.1-SNAPSHOT
[INFO] +- javax.ws.rs:jsr311-api:jar:1.0:compile
[INFO] +- org.apache.cxf:cxf-rt-databinding-jaxb:jar:2.2:compile
[INFO] | +- org.apache.cxf:cxf-api:jar:2.2:compile
[INFO] | | +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.4:compile
[INFO] | | +- org.apache.geronimo.specs:geronimo-annotation_1.0_spec:jar:1.1.1
:compile
[INFO] | | +- org.apache.neethi:neethi:jar:2.0.4:compile
[INFO] | | | \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] | | \- org.apache.cxf:cxf-common-schemas:jar:2.2:compile
[INFO] | +- org.apache.cxf:cxf-rt-core:jar:2.2:compile
[INFO] | | \- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.2:compile
[INFO] | +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.5:compil
e
[INFO] | +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0.2:co
mpile
[INFO] | +- org.codehaus.woodstox:wstx-asl:jar:3.2.6:compile
[INFO] | +- com.sun.xml.bind:jaxb-impl:jar:2.1.9:compile
[INFO] | | \- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | \- com.sun.xml.bind:jaxb-xjc:jar:2.1.9:compile
[INFO] +- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:2.2:compile
[INFO] | +- org.apache.cxf:cxf-common-utilities:jar:2.2:compile
[INFO] | | +- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:c
ompile
[INFO] | | +- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] | | +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] | | \- commons-lang:commons-lang:jar:2.4:compile
[INFO] | +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.2:compile
[INFO] | +- org.apache.cxf:cxf-rt-transports-http:jar:2.2:compile
[INFO] | | \- org.springframework:spring-web:jar:2.5.5:compile
[INFO] | +- org.apache.cxf:cxf-rt-databinding-aegis:jar:2.2:compile
[INFO] | | \- org.apache.cxf:cxf-rt-frontend-simple:jar:2.2:compile
[INFO] | | +- org.apache.geronimo.specs:geronimo-jaxws_2.1_spec:jar:1.0:com
pile
[INFO] | | +- org.apache.cxf:cxf-rt-bindings-soap:jar:2.2:compile
[INFO] | | | \- org.apache.cxf:cxf-tools-common:jar:2.2:compile
[INFO] | | \- javax.xml.soap:saaj-api:jar:1.3:compile
[INFO] | +- org.codehaus.jettison:jettison:jar:1.0.1:compile
[INFO] | \- org.apache.xmlbeans:xmlbeans:jar:2.3.0:compile
[INFO] +- auditor:services-plan:jar:0.0.1-SNAPSHOT:compile
[INFO] | +- auditor:dataaccess:jar:0.0.1-SNAPSHOT:compile
[INFO] | \- auditor:dataaccess-jpa:jar:0.0.1-SNAPSHOT:compile
[INFO] \- auditor:model:jar:0.0.1-SNAPSHOT:compile
[INFO] +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] \- auditor:utils:jar:0.0.1-SNAPSHOT:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.5.6:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.5.6:compile
[INFO] | \- log4j:log4j:jar:1.2.14:compile
[INFO] \- org.springframework:spring:jar:2.5.6:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7 seconds
[INFO] Finished at: Sat Apr 11 13:56:22 BST 2009
[INFO] Final Memory: 13M/28M
[INFO] ------------------------------------------------------------------------
a...@alan1 /cygdrive/c/dev/workspaces/webaudit/services-remote
> IllegalAnnotationException on Collection properties, Getter must return
> "Collection", Setter must take "List" as parameter
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: CXF-2168
> URL: https://issues.apache.org/jira/browse/CXF-2168
> Project: CXF
> Issue Type: Bug
> Components: JAXB Databinding
> Environment: jax-rs
> Reporter: VividApp On Software
> Priority: Critical
>
> Problem is with jaxb in relation to jax-rs.
> This problem is excruciatingly annoying and has resulted in days of wasted
> time, almost to the point of giving up!!
> I am marking this as Critical, as I think it will drive people away from
> using CXF jax-rs if they encounter this problem.
> Getting some very strange behaviour with Collection properties if I do not do
> the following.
> - The Getter must a type of "Collection"
> - The Setter parameter must be a "List".
> If both Getter and Setter are consistent and both return either a Collection
> or a List, an IllegalAnnotationException occurs (See Debug output below).
> ie. One must return a Collection, and the other must take a List.
> I get this if I annotate with @XmlElementRefs and also with @XmlAnyElement
> (coupled with @XmlSeeAlso)
> I don't think this is a problem with the jaxb-api, as I also tried it with
> jaxb 2.0
> I have included my Maven dependency at the bottom.
> ############################
> My code is as follows:
> @XmlRootElement(name = "data")
> // @XmlSeeAlso({Echo.class, Basicdetails.class, UrlDescriptor.class})
> public class Data {
>
> // @XmlAnyElement(lax = true)
> @XmlElementRefs({
> @XmlElementRef(name = "basicdetails", type = Basicdetails.class),
> @XmlElementRef(name = "urldescriptor", type = UrlDescriptor.class),
> @XmlElementRef(name = "echo", type = Echo.class)
> })
> private Collection<Record> records;
> public Data() {
> }
> public Data(final Record record) {
> addRecord(record);
> }
> public Collection<Record> getRecords() {
> return records;
> }
> /**
> * THIS MUST TAKE A LIST, EXCEPTIONS OTHERWISE, EVEN THOUGH GETTER IS
> RETURNING "Collection"
> */
> public void setRecords(final List<Record> records) {
> this.records = records;
> }
>
> public void addRecord(final Record record) {
> if (this.records == null) {
> setRecords(new ArrayList<Record>());
> }
> getRecords().add(record);
> }
> }
> ########################################################
> DEBUG OUTPUT:
> Content-Type: text/xml
> Headers: {content-length=[748], accept-encoding=[gzip, deflate],
> cache-control=[no-cache], connection=[Keep-Alive],
> referer=[http://localhost:8888/com.webauditor.sanity.app.SanityApplication/SanityApplication.html],
> host=[localhost:8888], accept-language=[en-gb], user-agent=[Mozilla/4.0
> (compatible; MSIE 7.0; Windows NT 5.1; GTB5; .NET CLR 1.1.4322; .NET CLR
> 2.0.50727)], ua-cpu=[x86], content-type=[text/xml], Accept=[*/*]}
> Payload:
> <request>
> <data>
> <basicdetails>
> <startUrl>http://</startUrl>
> <maxPages>100</maxPages>
> <javascriptEnabled>true</javascriptEnabled>
> <browserType>Internet Explorer</browserType>
> </basicdetails>
> </data>
> <oldValues>
> <startUrl>http://</startUrl>
> <maxPages>100</maxPages>
> <javascriptEnabled>true</javascriptEnabled>
> <browserType>Firefox</browserType>
> </oldValues>
> <dataSource>basicdetails</dataSource>
> <operationType>update</operationType>
> <operationId></operationId>
> <startRow></startRow>
> <endRow></endRow>
> <sortBy></sortBy>
> <textMatchStyle></textMatchStyle>
> <componentId>basicdetails</componentId>
> </request>
> --------------------------------------
> 1
> Submitting current
> SAVING EDITS
> 1
> Submitting current
> SAVING EDITS
> 1
> Submitting current
> SAVING EDITS
> 10-Apr-2009 18:21:06 org.apache.cxf.jaxrs.provider.AbstractJAXBProvider
> handleJAXBException
> WARNING: JAXBException occurred : 3 counts of IllegalAnnotationExceptions
> 10-Apr-2009 18:21:06 org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper
> toResponse
> WARNING: WebApplicationException has been caught : 3 counts of
> IllegalAnnotationExceptions
> 10-Apr-2009 18:21:06
> org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
> INFO: Outbound Message
> ---------------------------
> Encoding:
> Content-Type: text/plain
> Headers: {Content-Type=[text/plain]}
> Payload: JAXBException occurred : 3 counts of IllegalAnnotationExceptions
> --------------------------------------
> 10-Apr-2009 18:21:06
> org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
> INFO: Outbound Message
> ---------------------------
> Encoding:
> Content-Type: text/plain
> Headers: {Content-Type=[text/plain]}
> Payload: JAXBException occurred : 3 counts of IllegalAnnotationExceptions
> --------------------------------------
> #############################################################
> MAVEN SETUP
> <dependencies>
> <dependency>
> <groupId>javax.ws.rs</groupId>
> <artifactId>jsr311-api</artifactId>
> <version>1.0</version>
> </dependency>
> <dependency>
> <groupId>org.apache.cxf</groupId>
> <artifactId>cxf-bundle-jaxrs</artifactId>
> <version>2.2</version>
> <exclusions>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-context</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-beans</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.springframework</groupId>
> <artifactId>spring-core</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.abdera</groupId>
> <artifactId>abdera-i18n</artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.abdera</groupId>
> <artifactId>abdera-extensions-main
> </artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.abdera</groupId>
> <artifactId>abdera-extensions-json
> </artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.abdera</groupId>
> <artifactId>abdera-core
> </artifactId>
> </exclusion>
> <exclusion>
> <groupId>org.apache.abdera</groupId>
> <artifactId>abdera-parser
> </artifactId>
> </exclusion>
> </exclusions>
> </dependency>
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.