You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2026/10/08 15:43:12 UTC
(tomcat) 23/24: Match Jakarta namespace JMS types when classifying @Resource annotations.
This is an automated email from the ASF dual-hosted git repository.
rmaucher pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit a2d9cd987cc8709947997edcc134d1f390fce5f8
Author: opencode <re...@apache.org>
AuthorDate: Thu Oct 8 17:37:55 2026 +0200
Match Jakarta namespace JMS types when classifying @Resource annotations.
The type-string dispatch in WebAnnotationSet.addResource() still compared the
pre-Jakarta javax.jms and javax.resource literals. Since the codebase uses the
jakarta.* namespace and neither the javax nor the jakarta JMS API is bundled
with Tomcat, the javax.jms.Queue and javax.jms.Topic comparisons could never
match, so a @Resource on a jakarta.jms.Queue or jakarta.jms.Topic member fell
through to the generic case and was registered as a resource-env-ref instead
of a message-destination-ref, losing the message-destination classification
and the usage metadata taken from the mapped name.
Use the jakarta.jms and jakarta.resource literals for the message-destination
and resource-ref branches. The resource-ref behaviour is unchanged either way
because the branch also matches any type ending in ConnectionFactory.
---
java/org/apache/catalina/startup/WebAnnotationSet.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/catalina/startup/WebAnnotationSet.java b/java/org/apache/catalina/startup/WebAnnotationSet.java
index d3cfd2c316..707c5f2c12 100644
--- a/java/org/apache/catalina/startup/WebAnnotationSet.java
+++ b/java/org/apache/catalina/startup/WebAnnotationSet.java
@@ -295,11 +295,11 @@ public class WebAnnotationSet {
context.getNamingResources().addService(service);
- } else if (type.equals("javax.sql.DataSource") || type.equals("javax.jms.ConnectionFactory") ||
- type.equals("javax.jms.QueueConnectionFactory") || type.equals("javax.jms.TopicConnectionFactory") ||
- type.equals("jakarta.mail.Session") || type.equals("java.net.URL") ||
- type.equals("javax.resource.cci.ConnectionFactory") || type.equals("org.omg.CORBA_2_3.ORB") ||
- type.endsWith("ConnectionFactory")) {
+ } else if (type.equals("javax.sql.DataSource") || type.equals("jakarta.jms.ConnectionFactory") ||
+ type.equals("jakarta.jms.QueueConnectionFactory") ||
+ type.equals("jakarta.jms.TopicConnectionFactory") || type.equals("jakarta.mail.Session") ||
+ type.equals("java.net.URL") || type.equals("jakarta.resource.cci.ConnectionFactory") ||
+ type.equals("org.omg.CORBA_2_3.ORB") || type.endsWith("ConnectionFactory")) {
// resource-ref element
ContextResource resource = new ContextResource();
@@ -320,7 +320,7 @@ public class WebAnnotationSet {
context.getNamingResources().addResource(resource);
- } else if (type.equals("javax.jms.Queue") || type.equals("javax.jms.Topic")) {
+ } else if (type.equals("jakarta.jms.Queue") || type.equals("jakarta.jms.Topic")) {
// message-destination-ref
MessageDestinationRef resource = new MessageDestinationRef();
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org