Jakarta EE 9 behavior differences
When moving to Jakarta EE 9 in Liberty, there might be some behavior differences in your application because of implementation changes and specification clarifications. Liberty does not require you to move to the next Java EE level and can continue to use the existing Java EE 6, Java EE 7, or Java EE 8 features. If you move to Jakarta EE 9 level, all technologies used by the application must be migrated to the Jakarta EE 9 level.
General Rules
| Rule Name | Rule Description | Automated Fix |
|---|---|---|
| Update your application to use the new Jakarta EE package name | In Jakarta EE 9 the package namespace has changed from javax.* to jakarta.*. |
jakarta-ee-9.yml org.openrewrite.java.migrate.jakarta.JavaxMigrationToJakarta |
Jakarta Enterprise Beans 4.0
| Rule Name | Rule Description | Automated Fix |
|---|---|---|
| Differences in EJB contexts | The getCallerIdentity(), getEnvironment(), and
isCallerRole(java.security.Identity) methods from the javax.ejb.EJBContext
class have been removed. The getMessageContext() method from the
javax.ejb.SessionContext class has been removed. |
No |
Jakarta Management
| Rule Name | Rule Description | Automated Fix |
|---|---|---|
| The Jakarta Management specification has been removed | This rule flags references to the javax.management.j2ee, javax.management.j2ee.statistics,
and org.omg.stub.javax.management.j2ee packages. |
No |
Jakarta XML Web Services 3.0
| Rule Name | Rule Description | Automated Fix |
|---|---|---|
| Update Apache Web Services security package names | The org.apache.ws.security and org.apache.ws.security.components.crypto packages
have been replaced by the org.apache.wss4j.common.ext and org.apache.wss4j.common.crypto packages. |
jakarta-ee-9.yml org.openrewrite.java.migrate.jakarta.UpdateApacheWSSecurityPackages |
RESTful Web Services 3.0
| Rule Name | Rule Description | Automated Fix |
|---|---|---|
| @ApplicationPath, @Path, and @Provider are now CDI bean-defining annotations | This rule flags the usage of the @ApplicationPath, @Path, and @Provider annotations. | No |
| Application subclasses using CDI injection must be annotated with the @ApplicationPath annotation | This rule flags the usages of CDI annotations in an Application subclass without the usage of the @ApplicationPath annotation. | No |
| Avoid using sub-resource methods and sub-resource locators with the same path | This rule flags javax.ws.rs.Path method annotations that define the same path across more than one method. |
No |
| Behavior change when using the Application.getSingletons() method | This rule flags implementations of the Application.getSingletons() method. |
No |
| Check for a behavior change on HttpHeaders.getRequestHeader(String) | This rule flags Java code that calls the javax.ws.rs.core.HttpHeaders.getRequestHeader(String) method. |
No |
| Check for a behavior change on Response.readEntity() | This rule flags Java code that calls the javax.ws.rs.core.Response.readEntity() method. |
No |
| Check for local interfaces in the Application.getClasses() return value | This rule flags implementations of the javax.ws.rs.Application.getClasses() method. |
No |
| JAX-RS parameters cannot be injected into a resource class constructor | This rule flags JAX-RS parameters that are injected into a resource class constructor. | No |
| JSON4JObjectProvider is unavailable | This rule flags the com.ibm.websphere.jaxrs.providers.json4j.JSON4JObjectProvider class. |
No |
| Liberty RESTful Web Services client properties are deprecated | The ClientBuilder properties of com.ibm.ws.jaxrs.client.receive.timeout and
com.ibm.ws.jaxrs.client.connection.timeout are deprecated in Jakarta EE9.
Use the ClientBuilder connectTimeout and readTimeout methods instead. |
No |
| Null properties are removed in the jakarta.ws.rs.client API | Do not use properties with null values with the jakarta.ws.rs.client API. |
No |
| Remove the wild-card character from ApplicationPath annotation values | This rule flags any javax.ws.rs.ApplicationPath annotations with a specified value that ends in /*. |
jakarta-ee-9.yml org.openrewrite.java.migrate.jakarta.ApplicationPathWildcardNoLongerAccepted |
| Server-side asynchronous support must be enabled | This rule flags the usage of the @Suspended annotations on parameter type AsyncResponse in a JAX-RS resource method. | No |
Spring Framework 6.0
| Rule Name | Rule Description | Automated Fix |
|---|---|---|
| Update Spring Framework to a Jakarta EE 9 supported version | This rule flags any spring-core-X.X.X.RELEASE.jar/META-INF/MANIFEST.MF file with an Implementation-Version value lower than 6. |
spring-framework-60.yml org.openrewrite.java.spring.framework.UpgradeSpringFramework_6_0 |
| Do not use Ehcache 2.x | This rule flags the usage of org.springframework.cache.ehcache package or presence of ehcache.xml file. |
No |
| Do not use dedicated Spring EJB access classes to lookup EJB | This rule flags the usage of the org.springframework.ejb.access package in Java .class files or .xml files. For Spring 6.0 use JNDI directly via JndiObjectFactoryBean in Java files or jee:jndi-lookup in .xml files. |
No |
| Methods annotated with @Async must return either Future or void | This rule flags Java methods annotated with org.springframework.scheduling.annotation.Async that return types other than void, Future<t>, CompletableFuture<t> or ListenableFuture<t>. |
No |
| The SourceHttpMessageConverter class is not registered by default | This rule flags usage of the javax.xml.transform.Source interface when the SourceHttpMessageConverter class is not found. In Spring Framework 6.0, the SourceHttpMessageConverter class is no longer registered by default in Spring MVC or RestTemplate. |
No |
| org.springframework.http.HttpMethod is now a class and no longer an enum | This rule flags usage of org.springframework.http.HttpMethod where the code assumes it is an enum. |
No |
| HttpComponentsClientHttpRequestFactory now requires Apache HttpClient 5 | Any usage of HttpClient 4.x classes such as CloseableHttpClient, HttpClient, RequestConfig, or HttpContext from the org.apache.http.* package within Spring’s HTTP client infrastructure (including constructors, method invocations, or configurations involving HttpComponentsClientHttpRequestFactory) can lead to compilation errors and must be updated to use the HttpClient 5.x equivalents. |
No |
| Avoid using deprecated ListenableFuture interface | This rule flags classes that implement the ListenableFuture interface. In SpringFramework 6.0 the ListenableFuture interface has been deprecated in favor of the CompletableFuture interface. |
No |
| CannotSerializeTransactionException and DeadlockLoserDataAccessException are deprecated as of Spring 6.0.3 | This rule flags Java code that uses Spring’s deprecated locking-related exceptions CannotSerializeTransactionException and DeadlockLoserDataAccessException. |
No |
| Enable legacy SQLErrorCodeSQLExceptionTranslator for database-specific error codes | This rule flags usage of the org.springframework.jdbc* package. Spring Framework 6.0 switches to a new exception translator SQLExceptionSubclassTranslator that avoids vendor-specific error codes |
No |
| SimpleEvaluationContext disables array allocations | This rule flags usage of org.springframework.expression.spel.support.SimpleEvaluationContext with Expression.getValue(...). |
No |