RESTeasy: getting started with Maven

To get your maven projects started with RESTeasy, you’ll have to make sure that you add the following entries to your pom.xml:


to your section and




To your section.

That’s the minimum requirement to use resteasy and it wrks fine,a s long as you return strings or you create your own return XML with something like simpleXML. That approach is OK if your service consumer is some Non – Java Application like Flex for instance.

However, if you want to use RESTeasy as an interop – alternative to EJB/RMI/IIOP, you’ll want to have a close look at RESTeasy’s very comfortable JAXB – implementation and client libraries. These are basically equivalent to the typical EJB case in terms of use, since RESTeasy allows JAXB – annotated return type POJOs with interface declarations for REST methods used by the service and it’s client. The client just calls the client side ProxFactory with the interface declaration and voilá: you get the JAXB annotated POJO as a result. RESTeasy takes care of marshalling and unmarshelling the JAXB POJO.

You’ll have to add a few dependencies to your maven pom.xml in order to take advantage of this:




and additionally




if you want to combine JAXB with Atom. It is also possible to combine JSON and JAXB. See the JBoss docs for details.

If you avoid adding the depencies, you’ll get the following irritating error:

Unable to find a MessageBodyReader of content-type application/xml and type class …

which means that RESTeasy was unable to find the provider for JAXB. This dependency must be available on the client and on the server.

This entry was posted in Distributed Computing, Enterprise Java. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s