This repository shows how to configure a DataSource with JNDI in a Grails 3 app deployed in tomcat.
- Define resource in /apache-tomcat-8.5.2.3/conf/context.xml
- Configure DataSource to use JNDI - In the Grails 3 application, app configure for production environment to jndiName for dataSource configuration.
- 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.
-
Generate WAR file. build your grails app with ./gradlew assemble.
-
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
- Start tomcat
apache-tomcat-8.5.2.3/bin/$ ./startup.sh
Your grails application should populate the database with three books.