Adam Bien's Weblog

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!


NEW workshop: HTML 5 and JavaScript Essentials, Three days in April 2017: from Java EE 7 Architectures over Microservices to Performance, Troubleshooting and Monitoring
On demand workshops: Java EE 7: Bootstrap, Effective, Testing and Microservices available for streaming.

Newsletter: airhacks.news

A book about rethinking Java EE Patterns

Comments:

Have you activated JAX-RS 2.0 by deploying jax-rs-2.0.war from $ORACLE_HOME/wlserver/common/deployable-libraries?

I found WLS12.1.3 very unpleasent to work with.

The Netbeans process often looses the state of the Server, debugging is a pain. I very often need to manually redeploy or even restart Weblogic.
Glassfish4 is working much better with Netbeans.

I also think, Appservers these days implement too many APIs that are no always easy to override with a newer Implementation.

Posted by Daniel on July 29, 2014 at 01:24 PM CEST #

Unfortunately, it is quite common for such oversized JEE application server to not support any standard examples from Internet if you do not tweak it before ;)

Posted by Nicolas on July 29, 2014 at 03:45 PM CEST #

It does not work with a @Produces annotation either. Looks like there are some jars missing;).

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/json was not found.

I was hoping that this was an NetBeans integration issue with broken .war content. Just to tell you that NetBeans is a dead end. Didn't work out this time;(.

Posted by Jens Schumann on July 29, 2014 at 06:12 PM CEST #

@Jens Schumann: what is your alternative IDE when not suggesting NetBeans? I am currently trying to find alternatives to Eclipse and I am lost.

Posted by gehirnmann on June 16, 2015 at 02:40 PM CEST #

Put out the fire:
https://docs.oracle.com/middleware/1213/wls/RESTF/use-jersey20-ri.htm#RESTF290

Posted by Jøran on December 12, 2016 at 12:39 AM CET #

Post a Comment:
  • HTML Syntax: NOT allowed
realworldpatterns.com
Online Workshops
...the last 150 posts
...the last 10 comments
License