adam bien's blog

WLS 12c (12.1.3) and Java EE 7, Some Smoke 📎

WLS 12c supports some Java EE 7 API like: JSON Processing (JSR 353), JAX-RS 2.0, JPA 2.1 http://docs.oracle.com/middleware/1213/wls/NOTES/index.html. Now it is time for a Smoke Test:

  1. Download size is reasonable: 198,7 MB for a generic ZIP. However: the download requires a login to OTN. This is an unnecessary barrier for developers.
  2. Installation is easy: setting a MW_HOME variable pointing to the extraction folder and executing the configure.sh
  3. NetBeans 8 integration worked out-of-the-box. Application was directly deployed from NetBeans with Maven 3. WLS is nicely integrated with NetBeans: you can start, stop and deploy your application directly from NetBeans. Also a useful feature: WLS and GlassFish are using different ports--you can run both servers at the same time.
  4. wls12c was installed on Java 8 (1.8.0-b132 / mac) without any problems
  5. Java EE 6 tests were passed

Interestingly: a basic JAX-RS service with JsonObject works perfectly on GlassFish v4, but fails on WLS 12.1.3:


@Stateless
@Path("alert")
public class AlertResource {

    @Inject
    FireState fireState;

    @GET
    public JsonObject get() {
        return Json.createObjectBuilder().
				add("Smoke?:", fireState.isSmoke()).
				build();
    }
}

<Error> <com.sun.jersey.spi.container.ContainerResponse> <BEA-000000> <Mapped exception to response: 500 (Internal Server Error) javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class org.glassfish.json.JsonObjectBuilderImpl$JsonObjectImpl, and Java type interface javax.json.JsonObject, and MIME media type application/octet-stream was not found.

Seems like the "Accept" header is ignored. The request was initiated by: curl -H "Accept: application/json" http://localhost:7001/server-smoke/resources/alert and browser link.

See you at Java EE Workshops at MUC Airport or on demand and in a location very near you: airhacks.io!