This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 11.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/11.0.x by this push:
new 5c6d0f7ab9 Follow-up to code review - lookup service consistently
5c6d0f7ab9 is described below
commit 5c6d0f7ab92d91bfae9e5090c492c5d3e4cf2a74
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Jun 22 22:47:09 2026 +0100
Follow-up to code review - lookup service consistently
---
java/org/apache/catalina/core/ApplicationContext.java | 3 +--
java/org/apache/catalina/manager/ManagerServlet.java | 9 ++++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/java/org/apache/catalina/core/ApplicationContext.java
b/java/org/apache/catalina/core/ApplicationContext.java
index 39e2fc028e..28363b2e44 100644
--- a/java/org/apache/catalina/core/ApplicationContext.java
+++ b/java/org/apache/catalina/core/ApplicationContext.java
@@ -60,7 +60,6 @@ import jakarta.servlet.http.HttpSessionListener;
import org.apache.catalina.Container;
import org.apache.catalina.Context;
-import org.apache.catalina.Engine;
import org.apache.catalina.Globals;
import org.apache.catalina.LifecycleState;
import org.apache.catalina.Service;
@@ -96,7 +95,7 @@ public class ApplicationContext implements ServletContext {
public ApplicationContext(StandardContext context) {
super();
this.context = context;
- this.service = ((Engine) context.getParent().getParent()).getService();
+ this.service = Container.getService(context);
this.sessionCookieConfig = new ApplicationSessionCookieConfig(context);
// Populate session tracking modes
diff --git a/java/org/apache/catalina/manager/ManagerServlet.java
b/java/org/apache/catalina/manager/ManagerServlet.java
index 4f596ce916..cc060f74b3 100644
--- a/java/org/apache/catalina/manager/ManagerServlet.java
+++ b/java/org/apache/catalina/manager/ManagerServlet.java
@@ -425,9 +425,12 @@ public class ManagerServlet extends HttpServlet implements
ContainerServlet {
}
// Acquire global JNDI resources if available
- Server server = ((Engine) host.getParent()).getService().getServer();
- if (server != null) {
- global = server.getGlobalNamingContext();
+ Service service = Container.getService(host);
+ if (service != null) {
+ Server server = service.getServer();
+ if (server != null) {
+ global = server.getGlobalNamingContext();
+ }
}
// Calculate the directory into which we will be deploying applications
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]