adds lookup-name to web.xml resource reference and removes custom JNDI context parameter

Sat, 16 May 2020 11:37:57 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 16 May 2020 11:37:57 +0200
changeset 50
2a90d105edec
parent 49
d9c24f0ab8f7
child 51
dd0a45ae25d7

adds lookup-name to web.xml resource reference and removes custom JNDI context parameter

also removes jstl-impl from compile time dependencies - tomcat users must provide the library manually

pom.xml file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/Constants.java file | annotate | diff | comparison | revisions
src/main/java/de/uapcore/lightpit/DatabaseFacade.java file | annotate | diff | comparison | revisions
src/main/webapp/WEB-INF/web.xml file | annotate | diff | comparison | revisions
     1.1 --- a/pom.xml	Sat May 16 09:28:57 2020 +0200
     1.2 +++ b/pom.xml	Sat May 16 11:37:57 2020 +0200
     1.3 @@ -33,13 +33,14 @@
     1.4          </dependency>
     1.5          <dependency>
     1.6              <groupId>javax.servlet</groupId>
     1.7 -            <artifactId>jstl</artifactId>
     1.8 -            <version>1.2</version>
     1.9 +            <artifactId>javax.servlet-api</artifactId>
    1.10 +            <version>3.1.0</version>
    1.11 +            <scope>provided</scope>
    1.12          </dependency>
    1.13          <dependency>
    1.14              <groupId>javax.servlet</groupId>
    1.15 -            <artifactId>javax.servlet-api</artifactId>
    1.16 -            <version>3.1.0</version>
    1.17 +            <artifactId>jstl</artifactId>
    1.18 +            <version>1.2</version>
    1.19              <scope>provided</scope>
    1.20          </dependency>
    1.21      </dependencies>
     2.1 --- a/src/main/java/de/uapcore/lightpit/Constants.java	Sat May 16 09:28:57 2020 +0200
     2.2 +++ b/src/main/java/de/uapcore/lightpit/Constants.java	Sat May 16 11:37:57 2020 +0200
     2.3 @@ -48,11 +48,6 @@
     2.4      public static final String CTX_ATTR_LANGUAGES = "available-languages";
     2.5  
     2.6      /**
     2.7 -     * Name for the context parameter optionally specifying the JNDI context;
     2.8 -     */
     2.9 -    public static final String CTX_ATTR_JNDI_CONTEXT = "jndi-context";
    2.10 -
    2.11 -    /**
    2.12       * Name for the context parameter optionally specifying a database schema.
    2.13       */
    2.14      public static final String CTX_ATTR_DB_SCHEMA = "db-schema";
     3.1 --- a/src/main/java/de/uapcore/lightpit/DatabaseFacade.java	Sat May 16 09:28:57 2020 +0200
     3.2 +++ b/src/main/java/de/uapcore/lightpit/DatabaseFacade.java	Sat May 16 11:37:57 2020 +0200
     3.3 @@ -139,9 +139,6 @@
     3.4  
     3.5          dataSource = null;
     3.6  
     3.7 -        final String contextName = Optional
     3.8 -                .ofNullable(sc.getInitParameter(Constants.CTX_ATTR_JNDI_CONTEXT))
     3.9 -                .orElse("java:comp/env");
    3.10          final String dbSchema = Optional
    3.11                  .ofNullable(sc.getInitParameter(Constants.CTX_ATTR_DB_SCHEMA))
    3.12                  .orElse(DB_DEFAULT_SCHEMA);
    3.13 @@ -155,9 +152,9 @@
    3.14          }
    3.15  
    3.16          try {
    3.17 -            LOG.debug("Trying to access JNDI context {}...", contextName);
    3.18 +            LOG.debug("Trying to access JNDI context ...");
    3.19              Context initialCtx = new InitialContext();
    3.20 -            Context ctx = (Context) initialCtx.lookup(contextName);
    3.21 +            Context ctx = (Context) initialCtx.lookup("java:comp/env");
    3.22  
    3.23              dataSource = retrieveDataSource(ctx);
    3.24  
     4.1 --- a/src/main/webapp/WEB-INF/web.xml	Sat May 16 09:28:57 2020 +0200
     4.2 +++ b/src/main/webapp/WEB-INF/web.xml	Sat May 16 11:37:57 2020 +0200
     4.3 @@ -14,6 +14,7 @@
     4.4          <res-ref-name>jdbc/lightpit/app</res-ref-name>
     4.5          <res-type>javax.sql.DataSource</res-type>
     4.6          <res-auth>Container</res-auth>
     4.7 +        <lookup-name>java:/jdbc/lightpit/app</lookup-name>
     4.8      </resource-ref>
     4.9      <error-page>
    4.10          <error-code>404</error-code>

mercurial