Monday, October 19, 2009

CXF JAX-RS IllegalAnnotationException - Class has two properties of the same name

I am currently using Apache CXF to provide RESTful web services for the Australian PhenomeBank.

I was attempting to assign annotations of private field members of a class as follows:

    @XmlElement(name="mutationType")
    @XmlElementWrapper(name="mutationTypes")
    private Set<MutationType> mutationTypes  = EnumSet.noneOf(MutationType.class);

What I had forgot to do was assign the XmlAccessorType as follows:

@XmlRootElement(name="SearchCriteria")
@XmlAccessorType(XmlAccessType.FIELD)
public class SearchCriteria

Thursday, October 15, 2009

Ant OutOfMemoryException

Currently where I work we use Ant to deploy our application to a Tomcat server. Recently, I integrated several new libraries for Apache's CXF web services and reran my ant script to do the deployment and encountered this:

deploy:
[echo] Deploying to 150.203.7.14:8080 ...

BUILD FAILED
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:61)

at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)


To resolve this I ended up setting the ANT_OPTS environment variable on my Windows machine as follows:

C:\workspace\PhenomeBank>set ANT_OPTS=-Xmx500m