Hi,
You can follow the below steps.
1. Install tomcat server. Lets call the installation directory
[TOMCAT_FOLDER]/lib/2.
Generic JDBC Driver If you are using tomcat 6.0 or below, download tomcat-jdbc.jar and put it inside
[TOMCAT_FOLDER]/lib/You can download this here:
http://www.java2s.com/Code/JarDownload/tomcat-jdbc/tomcat-jdbc.jar.zip3.
Database specific JDBC driverNext, put your JDBC driver into
[TOMCAT_FOLDER]/lib/. For oracle, its
ojdbc.jar, for MySQL it is
mysql-connector.jar [Make sure you get the right version of the JAR]
4.
Configure JNDI for tomcatNext, in your
admin OR
site (anyone of these) module in your broadleaf workspace, there is a folder named
targetwhich has another folder
tomcat-server-config. This folder has a file
context.xml.
- Copy this file into [TOMCAT_FOLDER]/conf/
- Before replacing, make sure, you backup the original file
- Now, open this file and replace the following properties with your database values
- username="${database.user}" : Replace with your database username
- password="${database.password}" : Replace with your database password
- driverClassName="${database.driver}" : Replace with your database classname (e.g. oracle.jdbc.driver.OracleDriver)
- url="${database.url}" : Replace with your database URL with database path, port and name. (e.g. jdbc:oracle:thin:@localhost:1521:orcl)
5.
Let the application know about configured JNDINext, open
web.xml for both,
site and
admin modules.
Add the following code in both web.xml files.
Code: Select all
<!-- EXTERNAL SERVER CONFIGURATION -->
<resource-ref>
<description>WEB</description>
<res-ref-name>jdbc/web</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>STORAGE</description>
<res-ref-name>jdbc/storage</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>SECURE</description>
<res-ref-name>jdbc/secure</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
6.
Create keystore for SSL switchingNext, open cmd prompt [for windows] OR command shell [for linux].
Navigate to your
[JDK directory]/bin and run the below command.
Code: Select all
keytool -genkey -alias tomcat -keyalg RSA -storepass password
7.
Enable ports for switching to secure pagesNext, open
[TOMCAT_FOLDER]/conf/server.xmlAdd the following code to enable SSL switching, just below your default connector port.
Default connector port would look somewhat like
Code: Select all
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
Add below code just below the above code.
Code: Select all
<Connector port="8443" maxThreads="200"
scheme="https" secure="true" SSLEnabled="true"
keystorePass="password"
clientAuth="false" sslProtocol="TLS"/>
8.
DeploymentFinally, copy the WAR files created by MAVEN in your eclipse, and paste into
[TOMCAT_FOLDER]/webapp/folder.
9. Start tomcat, and access the application by
http://localhost:8080/<your_war_file_name>Let me know how it goes..