You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "VividApp On Software (JIRA)" <ji...@apache.org> on 2009/04/10 19:39:14 UTC

[jira] Created: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697964#action_12697964 ] 

Sergey Beryozkin commented on CXF-2168:
---------------------------------------

Hi,

thanks for opening this JIRA.

Can you please help me a bit more :

1. post the sample resource class and other classes such as Record, etc which are needed for the above composite <request> be deserialized.

I do suspect the problem is coming from the fact that  CXF JAXRS picks up a wrong JAXB dependency.
Would it be possible for you to try to 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 ?

please post the sample and more classes and I'll try to get to the bottom of it 

> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12699155#action_12699155 ] 

Sergey Beryozkin commented on CXF-2168:
---------------------------------------

Hi, let me ask you  a naive question :

Can you get your code working as expected, with set(Collection<Record> records) without using cxf jaxrs bundle ? That is can you get an xml instance like the one you posted with just jaxb-api and jaxb-impl dependencies in some unit test ?

thanks, Sergey


> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12699161#action_12699161 ] 

Sergey Beryozkin commented on CXF-2168:
---------------------------------------

Hi Alan

> I'm 99% sure I tried it and had the same problem.  

then wouldn't you agree then it's a JAXB-specific issue as opposed to a CXF JAXRS issue ?

Give it a try please. Did you ask on the JAXB list ? It appears, from what I've seen so far on the Google that collection setters are not even called by JAXB

cheers, Sergey

> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698080#action_12698080 ] 

VividApp On Software commented on CXF-2168:
-------------------------------------------

Thanks Sergev,

Code samples are on the way. I am using the cxf jaxrs bundle as you can see from the output above

Here's my maven dependencies, from a mvn:dependency:tree


Alan@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-bundle-jaxrs:jar:2.2:compile
[INFO] |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-annotation_1.0_spec:jar:1.1.1:co
mpile
[INFO] |  +- javax.xml.bind:jaxb-api:jar:2.1:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-stax-api_1.0_spec:jar:1.0.1:comp
ile
[INFO] |  +- wsdl4j:wsdl4j:jar:1.6.2:compile
[INFO] |  +- xml-resolver:xml-resolver:jar:1.2:compile
[INFO] |  +- org.apache.ws.commons.schema:XmlSchema:jar:1.4.4:compile
[INFO] |  +- commons-lang:commons-lang:jar:2.4:compile
[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] |  +- org.apache.neethi:neethi:jar:2.0.4:compile
[INFO] |  +- com.sun.xml.bind:jaxb-impl:jar:2.1.9:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.5:compil
e
[INFO] |  +- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.2:compile
[INFO] |  +- org.springframework:spring-web:jar:2.5.5:compile
[INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.15:compile
[INFO] |  +- org.mortbay.jetty:jetty-util:jar:6.1.15:compile
[INFO] |  +- org.slf4j:slf4j-jdk14:jar:1.3.1:runtime
[INFO] |  +- org.apache.geronimo.specs:geronimo-servlet_2.5_spec:jar:1.2:compile

[INFO] |  +- org.apache.geronimo.specs:geronimo-jaxws_2.1_spec:jar:1.0:compile
[INFO] |  +- javax.xml.soap:saaj-api:jar:1.3:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.3:compile
[INFO] |  +- org.apache.ws.commons.axiom:axiom-impl:jar:1.2.7:compile
[INFO] |  +- org.apache.ws.commons.axiom:axiom-api:jar:1.2.7:compile
[INFO] |  +- jaxen:jaxen:jar:1.1:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  +- xml-apis:xml-apis:jar:1.3.02:compile
[INFO] |  |  +- xerces:xercesImpl:jar:2.6.2:compile
[INFO] |  |  \- xom:xom:jar:1.0:compile
[INFO] |  |     +- xerces:xmlParserAPIs:jar:2.6.2:compile
[INFO] |  |     +- xalan:xalan:jar:2.6.0:compile
[INFO] |  |     \- com.ibm.icu:icu4j:jar:2.6.1: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: 12 seconds
[INFO] Finished at: Sat Apr 11 13:18:54 BST 2009
[INFO] Final Memory: 12M/26M
[INFO] ------------------------------------------------------------------------

Alan@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.


[jira] Resolved: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-2168.
-----------------------------------

    Resolution: Won't Fix

It's a JAXB issue. CXF 2.2.3 will log much more informative JAXB warnings so such issues should be easier to resolve

> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698082#action_12698082 ] 

VividApp On Software commented on CXF-2168:
-------------------------------------------

The basicdetails interface:

package com.webauditer.remote.dto;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name="basicdetails")
public class Basicdetails implements Record {
	private String planId;
	private String planName;
	private int maxPages;
	private String browserType;
	private boolean javascriptEnabled;
	
	public String getPlanName() {
		return planName;
	}
	public void setPlanName(String name) {
		this.planName = name;
	}
	public int getMaxPages() {
		return maxPages;
	}
	public void setMaxPages(int maxPages) {
		this.maxPages = maxPages;
	}
	public String getBrowserType() {
		return browserType;
	}
	public void setBrowserType(String browserType) {
		this.browserType = browserType;
	}
	public boolean isJavascriptEnabled() {
		return javascriptEnabled;
	}
	public void setJavascriptEnabled(boolean javascriptEnabled) {
		this.javascriptEnabled = javascriptEnabled;
	}
	public String getPlanId() {
		return planId;
	}
	public void setPlanId(String planId) {
		this.planId = planId;
	}
	
}



> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698250#action_12698250 ] 

Sergey Beryozkin commented on CXF-2168:
---------------------------------------

Hi, thanks for all the updates - I'll investigate and get it fixed. CXF JAXRS bundle will also need to be stripped of few dependencies it does not actually need.

> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704168#action_12704168 ] 

Sergey Beryozkin commented on CXF-2168:
---------------------------------------

Hi Alan

Did you get a chance to try it without CXF JAX-RS ?

thanks, Sergey

> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698081#action_12698081 ] 

VividApp On Software commented on CXF-2168:
-------------------------------------------

The Record interface:


package com.webauditer.remote.dto;


// @XmlSeeAlso({Echo.class, Basicdetails.class, UrlDescriptor.class})
public interface Record {

}



> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12699157#action_12699157 ] 

VividApp On Software commented on CXF-2168:
-------------------------------------------

Hi Sergev,

I'm 99% sure I tried it and had the same problem. 

I should be able to give it a try again tonight (in about 7/8 hours when I get home, am away from the PC with the code), just to be sure.

Thanks Sergey,

Alan. 

> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ 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,

Alan@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] ------------------------------------------------------------------------

Alan@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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698083#action_12698083 ] 

VividApp On Software commented on CXF-2168:
-------------------------------------------

The "Data" class and the "Response" class (which has data as a member, see the XML sample above)

package com.webauditer.remote.dto;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * 
 * @author Alan
 * 
 * @param <RECORD>
 */
@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;
	}

	public void setRecords(final Collection<Record> records) {
		this.records = records;
	}
	
	public void addRecord(final Record record) {
		System.out.println("!!!!!!!!!!!!!!!! CALLING addRecord");
		if (this.records == null) {
			setRecords(new ArrayList<Record>());
		}
		getRecords().add(record);
	}
}


---------------------------------------------------------

package com.webauditer.remote.dto;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "response")
public class Response {
	private int status;
	private Data data = new Data();

	public Response() {
	
	}
	
	public Response(final int status, final Record record) {
		this.status = status;
		data.addRecord(record);
	}
	
	
	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public Data getData() {
		return data;
	}

	public void setData(Data data) {
		this.data = data;
	}
}





> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12704626#action_12704626 ] 

VividApp On Software commented on CXF-2168:
-------------------------------------------

Hi Sergey,

I've been tied up lately with some deadlines I have, - I haven't forgotten.
I'll definitely give it a go over the weekend.

Alan

> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698084#action_12698084 ] 

VividApp On Software commented on CXF-2168:
-------------------------------------------

The Request class:

package com.webauditer.remote.dto;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "request")
public class Request {
	private Data data;

	public Request() {
	}

	public Request(final  Basicdetails record) {
		this.data = new Data(record);
	}

	public Data getData() {
		return data;
	}

	public void setData(Data data) {
		this.data = data;
	}

	public Record getRecord() {
		return getData().getRecords() != null
				&& getData().getRecords().size() > 0 ? getData().getRecords()
				.iterator().next() : null;
	}
}



> 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.


[jira] Commented: (CXF-2168) IllegalAnnotationException on Collection properties, Getter must return "Collection", Setter must take "List" as parameter

Posted by "VividApp On Software (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698092#action_12698092 ] 

VividApp On Software commented on CXF-2168:
-------------------------------------------

Sorry, posted by mistake just there, the errors when excluding the com.sun.xml.bind group from cxf-rt-databinding-jaxb also are as follows: 

WARNING: WebApplicationException has been caught : com.sun.xml.bind.v2.ContextFactory
11-Apr-2009 14:02:58 org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
INFO: Outbound Message
---------------------------
Encoding: 
Content-Type: text/plain
Headers: {Content-Type=[text/plain]}
Payload: JAXBException occurred : com.sun.xml.bind.v2.ContextFactory
--------------------------------------
11-Apr-2009 14:02:58 org.apache.cxf.interceptor.LoggingOutInterceptor$LoggingCallback onClose
INFO: Outbound Message
---------------------------
Encoding: 
Content-Type: text/plain
Headers: {Content-Type=[text/plain]}
Payload: JAXBException occurred : com.sun.xml.bind.v2.ContextFactory
--------------------------------------



> 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.