Skip to content

Latest commit

 

History

History
31 lines (14 loc) · 1.25 KB

README.md

File metadata and controls

31 lines (14 loc) · 1.25 KB

tomcat-jndi-example

This repository shows how to configure a DataSource with JNDI in a Grails 3 app deployed in tomcat.

  1. Define resource in /apache-tomcat-8.5.2.3/conf/context.xml

https://github.com/grails-samples/tomcat-jndi-example/blob/master/apache-tomcat-8.5.2.3/conf/context.xml#L31

  1. Configure DataSource to use JNDI - In the Grails 3 application, app configure for production environment to jndiName for dataSource configuration.

https://github.com/grails-samples/tomcat-jndi-example/blob/master/app/grails-app/conf/application.yml#L109

  1. Create DB. This repository contains a simple datatabase schema.

Create a database with the database name and user / password credentials you defined in the previous resource.

  1. Generate WAR file. build your grails app with ./gradlew assemble.

  2. Copy your app to tomcat webapps

cp app/build/libs/app-0.1.war apache-tomcat-8.5.2.3/webapp/app-0.1.war

  1. Start tomcat

apache-tomcat-8.5.2.3/bin/$ ./startup.sh

Your grails application should populate the database with three books.