back to all blogsSee all blog posts

Jakarta EE 9 data source access and transactions in Open Liberty beta

image of author image of author
Laura Cowen and Kevin Sutter on Jul 7, 2020
Post available in languages:

In no time at all, we have a second Open Liberty beta which makes available another four Jakarta EE 9 features (JDBC 4.2 & 4.3, JTA 2.0, JSON-B 2.0, JSON-P 2.0), plus JNDI 1.0. This is in addition to the three features we beta’d in the first Open Liberty beta (Servlet 5.0, JSP 3.0, Expression Language 4.0).

Jakarta EE 9: behind the scenes

As we mentioned in our first beta blog post, the most visible change to developers between Jakarta EE 8 and Jakarta EE 9 is the new namespace: javax.* package names are now jakarta.* throughout the Jakarta EE 9 features. Behind the scenes, however, the Jakarta EE 9 project team have been working hard on changes to support Jakarta EE now and in future.

The list of specifications in Jakarta EE 9 has been modified since Jakarta EE 8. A subset of specifications that was part of Java SE 8 has been moved into Jakarta EE 9 instead. Some Jakarta 8 specifications have been removed from Jakarta EE 9, while other specifications from Jakarta EE 8 have been marked optional in Jakarta EE 9. This is intended to lower the bar of entry to new implementations by removing "stable" or legacy specifications, or at least making them optional so that application servers can be certified as compatible without necessarily supporting them.

If you’re interested in reading the Jakarta EE 9 specifications, there are now specifications, APIs, TCKs, and Compatible Implementations (CIs) for every specification. From the top-level specifications, you can navigate to any of the technologies to view their deliverables for their respective Milestone 1 releases. For example, here are the overall Jakarta EE 9 Platform and Jakarta Context Dependency Injection (CDI) 3.0 specifications.

In terms of progress, Jakarta EE 9 Milestone 1 was a great achievement but there’s still some way to go. The APIs are close to being finalized. Many of the component specifications are brand new from a Jakarta EE perspective so there is still some polishing required yet. All of the TCKs are buildable and executable but the success rate is variable, depending on the specific Jakarta EE technology being exercised. This is expected at this point in the game and will make progress every day. All of the TCK executions are on public Jenkins instances and can be monitored. Or, better yet, they always welcome more community help so, if you’re interested, get involved.

Every specification and associated TCK requires a Compatible Implementation (CI) to show completeness.  For the Jakarta EE 9 Milestone 1 deliverable, Eclipse Glassfish 6.0.0-M1 fulfills that role. But, as with Jakarta EE 8, there will be additional CIs for Jakarta EE 9, including Open Liberty.

We will demonstrate our on-going progress implementing Jakarta EE 9 on Open Liberty through our regular beta releases, now every 4 weeks.

Jakarta EE 9 features on Open Liberty

This beta of Open Liberty implements Java Database Connectivity (JDBC) integration with Java Transaction API (JTA), JSON-B 2.0 and JSON-P 2.0, plus JNDI 1.0. JNDI is not part of Jakarta EE 9 but it’s included to enable the use of data sources and transactions within applications. When added to the existing Jakarta EE 9 features, this means it is now possible to configure Servlet 5.0, JDBC 4.3 (on Java 11; JDBC 4.2 on Java 8), and JNDI 1.0 so that you can configure your applications to both access data sources and participate in global transactions.

The JSON-B and JSON-P features will come into their own when we finish JAX-RS in a future beta. So keep an eye on future beta blog posts.

Try it now

If you want to get started with the beta just update your build tools to pull the Open Liberty beta instead of the main release. The beta works with Java SE 11 or Java SE 8.

If you’re using Maven, here are the coordinates:

<dependency>
    <groupId>io.openliberty.beta</groupId>
    <artifactId>openliberty-jakartaee9</artifactId>
    <version>20.0.0.8-beta</version>
    <type>zip</type>
</dependency>

Or for Gradle:

dependencies {
    libertyRuntime group: 'io.openliberty.beta', name: 'openliberty-jakartaee9', version: '[20.0.0.8-beta,)'
}

Or take a look at our Downloads page.

To enable the new beta features in your app, add one or more of them to your server.xml (if you enable the jsp-3.0 feature, the servlet-5.0 and el-4.0 features are automatically enabled so you don’t need to explicitly list all three in that case):

Add the features to the server.xml:

<featureManager>
  <feature>jdbc-4.2</feature>
  <feature>jsonb-2.0</feature>
  <feature>jsonp-2.0</feature>
  <feature>jndi-1.0</feature>
  <feature>jsp-3.0</feature>
  <feature>servlet-5.0</feature>
  <feature>el-4.0</feature>
</featureManager>

Alternatively, you can just enable the Jakarta EE 9 convenience feature to enable them all at once:

<server>
  <featureManager>
    <feature>jakartaee-9.0</feature>
  </featureManager>
</server>

Let us know what you think on our mailing list. If you hit a problem, post a question on StackOverflow. If you hit a bug, please raise an issue.

Kevin is a co-Release Lead for the Jakarta EE 9 project, working with the wider community to help ensure that a cohesive specification is delivered and represents the expectations of the Jakarta EE Working Group. Laura is Content Strategist for Open Liberty and Editor of the OpenLiberty.io blog.