Jackson JSON Processor for Payara JAX-RS serialization/deserialization

Want to use Payara / Glassfish with JAX-RS and Jackson to serialize/deserialize objects to/from JSON? Pay extra attention as it might bite you as it had bit me. I was more than sure that Payara is using Jackson as JSON processor (I’ve checked pom.xml dependencies of Payara and found that Jackson 2.5.1 is defined there). Therefore, I started using all those nice @JsonProperty or @JsonAutoDetect annotations while scratching my head why is Payara ignoring them but still did “some” serialization using some defaults, i....

January 31, 2017 · 2 min

Java EE 7 -- JMS 2.0 With Glassfish v4

Java EE 7 has been recently accepted by the Executive Committee. This means that soon we should have Java EE 7 application servers available on the market. One of the specifications that constitutes Java EE 7 is JMS 2.0. Some interesting improvements were introduced since version 1.1. JMS has a lot of weird stuff like: Connection#createSession(boolean transacted, int acknowledgeMode) method. First method argument (transacted) defines if the session should be transacted....

May 9, 2013 · 5 min

GlassFish Java DB not started

I’ve had some problem with starting the GlassFish database. It occurs that in GlassFish 3.1 it started together with the Application Server (when you started the domain), but this doesn’t work for me since 3.1.1. So, if you see something like: Error connecting to server localhost on port 1527 with message Connection refused: connect. you can try to start the GlassFish Java DB by yourself. To do this, just invoke:...

February 28, 2012 · 1 min

Am I in the same transaction? Am I using the same PersistenceContext?

Recently, I’ve bumped into few posts on StackOverflow where people tend to compare container managed EntityManager instances (so the one injected by the container) by invoking EntityManager#toString() method. I’ve felt that it’s fundamentally wrong to compare EntityManager instances without knowing how they’re managed by the JPA provider or the Server Application. And what if this behaviour differs between Application Server vendors? The JPA provider provides an implementation of EntityManager – that’s obvious....

November 23, 2011 · 4 min

Screw Eclipse... and packages... and IDE... no, wait... screw me!

Just a note to myself – always check what classes are you importing in IDE, because if you see @Singleton in your class, it doesn’t mean it will work as a EJB Singleton. In my case it wasn’t referencing to javax.ejb.Singleton as I assumed, but com.sun.jersey.spi.resource.Singleton. Wasted 2 hours of looking for the answer or issue in a glassfish-3.1 JIRA. Did I mention I should always check the exact package of the imported class…?...

August 31, 2011 · 1 min

Arquillian, ShrinkWrap and archive filename

When you create a deployment using Arquillian (great test runner for testing your Java EE code in the container of your choice: jBoss, Glassfish, OpenEJB, … either in embedded, managed or remote mode) remember that the name of the deployment archive file is the exact filename that will be executed in the container. It does make a difference if you use *.war or *.jar for your deployment, so beware the following construct if it’s not exactly what you intended to do:...

June 13, 2011 · 1 min

Java EE 6 SCWCD Mock Exam

The mock exam has been moved to a separate application working on the OpenShift and is available at exam.piotrnowicki.com. This post will be still available because of the comments – at this point the exam simulator doesn’t have the commenting functionality so you can leave your opinion here. In time it’ll be modified and will allow to post comments directly next to the questions. If you’d like to get more information about the exam migration take a look at this post: New OCE WCD Exam Simulator....

March 27, 2011 · 1 min