https://bz.apache.org/bugzilla/show_bug.cgi?id=66163
Bug ID: 66163
Summary: tomcat-jakartaee-migration: conversion in "string
constants"
Product: Tomcat 10
Version: 10.0.22
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ------
Created attachment 38335
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38335&action=edit
Patch that also rollback conversion of jakarta. if class does not exist
Hi,
I am trying to run a Spring5 app (which uses javax.*) in Tomcat 10.0.22. I am
using the tomcat-jakartee-migration tool by using the <Loader
jakartaConverter="TOMCAT" /> configuration in my context.xml
I came across a problem that could be a bug(?) in the migration tool. At some
places spring is checking for the existence of javax.* classes, basically by
using for example Class.forName("javax.persistence.EntityManagerFactory", ...),
c.f for example
https://github.com/spring-projects/spring-framework/blob/5.3.x/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java
line 127ff.
Because "javax.persistence.EntityManagerFactory" is a constant it gets
converted by the ClassConverter of the migration tool. The regexp of the
EESpecProfile not only matches "jakarta/" but also "jakarta.". However the code
in the ClassConverter:101 which checks for the existence of the jakarta class
and would "roll back" the conversion only checks for "jakarta/" and not for
"jakarta.". This results in "javax.persistence.EntityManagerFactory" being
converted to "jakarta.persistence.EntityManagerFactory" which of course causes
Class.forName to fail.
The attached patch works for me but I don't know it has any negative side
effects that I don't see
Best regards
Ole
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]