Problem when deploying Rest WS on Jboss 7.4.X
[Jboss EAP upgrade] Problem when deploying Rest WS on Jboss 7.4.X

As we know, the anotations @Produces and @Consumes of “javax.ws.rs”, are generally recommended but they are NOT required for a Rest WS. That’s means, if we specify it, it’s cool and we will define the MIME types which will be returned, but if we don’t, it’s not very bad and our WS must works without these annotations. However, with the Jboss 7.4.x, it’s no longer TRUE !!
Since several updates were made in this version, concerning RESTEasy (which is the implementation or RX-JS included by JBOSS EAP), as result, you should encounter few issues when migrating from JBOSS 7.1.x to JBOSS 7.4x. Errors might be :HTTP “406 Not Acceptable” as specified by RFC 2616, org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: <OBJECT> of media type:… , or even a 404 service not found…
(For more inforation check the redhat documentation https://docs.redhat.com/en/documentation/red_hat_jboss_enterprise_application_platform/7.4/html/migration_guide/application_migration_changes#migrate_jax_rs_and_resteasy_application_changes).
Simple example of Rest endpoint which works on 7.1 but not on 7.4 :
@Path(“dates”) public class DateService { @GET @Path(“daysuntil/{targetdate}”) public long showDaysUntil(@PathParam(“targetdate”) String targetDate) { DateLogger.LOGGER.logDaysUntilRequest(targetDate); final long days; try { final LocalDate date = LocalDate.parse(targetDate, DateTimeFormatter.ISO_DATE); days = ChronoUnit.DAYS.between(LocalDate.now(), date); } catch (DateTimeParseException ex) { // DISCLAIMER . This example is contrived. throw new WebApplicationException(Response.status(400).entity(ex.getLocalizedMessage()).type(MediaType.TEXT_PLAIN) .build()); } return days; } }
This example seems respecting the JAX-RS 2.0 API Specification, despite that, it will not works on JBOSS 7.4.X.
To fix the issue, add the import for javax.ws.rs.Produces and the @Produces annotation as follows.
… import javax.ws.rs.Produces; … @Path(“dates”) public class DateService { @GET @Path(“daysuntil/{targetdate}”) @Produces(MediaType.TEXT_PLAIN) public long showDaysUntil(@PathParam(“targetdate”) String targetDate) { DateLogger.LOGGER.logDaysUntilRequest(targetDate); final long days; try { final LocalDate date = LocalDate.parse(targetDate, DateTimeFormatter.ISO_DATE); days = ChronoUnit.DAYS.between(LocalDate.now(), date); } catch (DateTimeParseException ex) { // DISCLAIMER . This example is contrived. throw new WebApplicationException(Response.status(400).entity(ex.getLocalizedMessage()).type(MediaType.TEXT_PLAIN) .build()); } return days; } }
It took me two days to realize that a simple annotation @Produces can cause deployment errors for my Rest endpoint :) … “ the devil is in the details”. I wish this story will be helpful for someone :)
Regards Anas ZEOUINENE
메타데이터
- post_id
- a84e4aeb38ff
- slug
- problem-when-deploying-rest-ws-on-jboss-7-4-x-a84e4aeb38ff
- url
- https://medium.com/@anas.zeouinene/problem-when-deploying-rest-ws-on-jboss-7-4-x-a84e4aeb38ff
- canonical_url
- https://medium.com/@anas.zeouinene/problem-when-deploying-rest-ws-on-jboss-7-4-x-a84e4aeb38ff
- author_url
- https://medium.com/@anas.zeouinene
- status
- ok
- fetched_at
- 2026-07-22 12:16:40