Deploy Demo Site into Stand Alone Tomcat server

Broadleaf Commerce Discussion Forum

Moderator: jocanas

incre2012
Newbie
Newbie
Posts: 13
Joined: Mon Aug 17, 2015 6:50 am

Deploy Demo Site into Stand Alone Tomcat server

Postby incre2012 » Fri Aug 28, 2015 6:46 am

The Broadleaf Demo site works in eclipse through an embedded tomcat server . Now I need to deploy and run it from a stand alone tomcat server .
Went through all relevent links on this as well as other popular forums . Google also did not help . So I am asking for help to solve this problem .

rudy
Beginner
Beginner
Posts: 25
Joined: Wed Jun 03, 2015 2:12 pm

Re: Deploy Demo Site into Stand Alone Tomcat server

Postby rudy » Sun Aug 30, 2015 10:37 am

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.zip

3. Database specific JDBC driver
Next, 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 tomcat
Next, in your admin OR site (anyone of these) module in your broadleaf workspace, there is a folder named target
which 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 JNDI

Next, 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 switching
Next, 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 pages
Next, open [TOMCAT_FOLDER]/conf/server.xml
Add 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. Deployment
Finally, 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.. :) ;) :mrgreen:

sumit17mar
Newbie
Newbie
Posts: 5
Joined: Tue Dec 27, 2016 8:34 am

Re: Deploy Demo Site into Stand Alone Tomcat server

Postby sumit17mar » Thu Jan 19, 2017 10:05 am

Hi ,

This is working good on local.

However, I want to host it on standalone tomcat. And the hosting provider does not provide access to tomcat/lib folder .

So I could not copy the mysql-connector jar in tomcat/lib folder .

Can you please share the steps to make mysql-connector.jar part of WAR to use it only for 'SITE'.

Many Thanks

sumit17mar
Newbie
Newbie
Posts: 5
Joined: Tue Dec 27, 2016 8:34 am

Re: Deploy Demo Site into Stand Alone Tomcat server

Postby sumit17mar » Tue Jan 24, 2017 7:07 am

@rudy

URGENT !!!

Can somebody please please help .


Return to “Broadleaf Commerce”

Who is online

Users browsing this forum: No registered users and 1 guest