From d78e1f8a30bb0d9676f659432a667b70abbf23ee Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Wed, 14 Oct 2020 13:03:28 +0200 Subject: [PATCH] Issue #5444 Fix deploy-jndi.adoc Signed-off-by: Jan Bartel --- .../operations-guide/deploy/deploy-jndi.adoc | 13 ++++++++----- .../asciidoc/operations-guide/jndi/chapter.adoc | 7 +++---- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jndi.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jndi.adoc index 904eaecc172..8f412e4ece6 100644 --- a/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jndi.adoc +++ b/jetty-documentation/src/main/asciidoc/operations-guide/deploy/deploy-jndi.adoc @@ -20,7 +20,7 @@ ==== Configuring JNDI Entries A web application may _reference_ a JNDI entry, such as a JDBC `DataSource` from the web application `web.xml` file. -The JNDI entry must be _defined_ in the Jetty context XML file, for example: +The JNDI entry must be _defined_ in a link:#og-jndi-xml[Jetty XML file], for example a context XML like so: .mywebapp.xml [source,xml,subs=normal] @@ -28,11 +28,11 @@ The JNDI entry must be _defined_ in the Jetty context XML file, for example: - + /mywebapp /opt/webapps/mywebapp.war #   - + jdbc/myds @@ -45,11 +45,14 @@ The JNDI entry must be _defined_ in the Jetty context XML file, for example: ---- +For more information and examples on how to use JNDI in Jetty, refer to the link:#og-jndi[JNDI] feature section. + [IMPORTANT] ==== -Class `com.mysql.cj.jdbc.MysqlConnectionPoolDataSource` is present in the MySQL JDBC driver file, `mysql-connector-java-.jar`, which must be available to the web application. +Class `com.mysql.cj.jdbc.MysqlConnectionPoolDataSource` is present in the MySQL JDBC driver file, `mysql-connector-java-.jar`, which must be available on the server's classpath . + +If the class is instead present _within_ the web application, then the JNDI entry must be declared in a `WEB-INF/jetty-env.xml` file - see the link:#og-jndi[JNDI] feature section for more information and examples. -File `mysql-connector-java-.jar` must be either present in `WEB-INF/lib`, or in the Jetty server class-path. ==== // TODO: add a link to reference the section about how // to add a JDBC driver jar to the server classpath. diff --git a/jetty-documentation/src/main/asciidoc/operations-guide/jndi/chapter.adoc b/jetty-documentation/src/main/asciidoc/operations-guide/jndi/chapter.adoc index fc315f4cd6b..53935565647 100644 --- a/jetty-documentation/src/main/asciidoc/operations-guide/jndi/chapter.adoc +++ b/jetty-documentation/src/main/asciidoc/operations-guide/jndi/chapter.adoc @@ -329,14 +329,13 @@ Server XML file:: Naming resources defined in a server XML file are link:#og-jndi-scope[scoped] at either the JVM level or the `org.eclipse.jetty.server.Server` level. The classes for the resource _must_ be visible at the Jetty *container* level. If instead the classes for the resource only exist inside your webapp, you must declare it in a `WEB-INF/jetty-env.xml` file. +Context XML file:: +Entries in a context XML file should be link:#og-jndi-scope[scoped] at the level of the webapp to which they apply (although it is possible to use a less strict scoping level of Server or JVM, but not recommended). +As with resources declared in a server XML file, classes associated with the resource _must_ be visible on the *container's* classpath. WEB-INF/jetty-env.xml:: Naming resources in a `WEB-INF/jetty-env.xml` file are link:#og-jndi-scope[scoped] to the webapp in which the file resides. While you can enter JVM or Server scopes if you choose, we do not recommend doing so. The resources defined here may use classes from inside your webapp. -This is a Jetty-specific mechanism. -Context XML file:: -Entries in a context XML file should be link:#og-jndi-scope[scoped] at the level of the webapp to which they apply (although it is possible to use a less strict scoping level of Server or JVM, but not recommended). -As with resources declared in a server XML file, classes associated with the resource _must_ be visible on the *container's* classpath. [[og-jndi-scope]] ===== Resource scoping