Documentation Home
Time will vary depending on connection speed, etc.
This will take
10 mins.

Running the Heat Clinic locally

Goals

This tutorial is designed to get the Heat Clinic running in your local environment using the command prompt for your operating system. By the end of this tutorial you will have the consumer-facing Heat Clinic store running locally, as well as, the Broadleaf admin, which is used to manage the Heat Clinic data.

Prerequisites

The Java 8 Development Kit: either the official Oracle JDK or Open JDK
The latest version of Maven - 3.3.1 minimum, the latest version is recommended)

Need help installing the pre-requisites on Windows, OSX, or Linux?


Steps

Now that all of the pre-requisites are installed, let's set up the Heat Clinic.

  1. Install Broadleaf

    1. Download the latest 5.1 Community Edition. Anyone can use the community edition to get hands on with core Broadleaf concepts like extension patterns and more in non-production environments. Only qualifying customers can use this edition in production
    2. Once you have the latest version of the Heat Clinic downloaded, unzip it and keep note of the location.
    3. At the command line for your operating system, change your directory to where the Heat Clinic is unzipped. Type mvn install and hit enter.

    This might take a while as all of the Broadleaf dependencies are downloaded

  2. Start the Admin

    Now let's start up the Heat Clinic admin by going into the admin directory from the command line and executing:

    OSX/Linux

    $ ./startadmin.sh
    

    Windows

    $ startadmin.bat
    

    Once this has finished, load the admin by going to http://localhost:8081/admin in your browser. The username/password is admin/admin

  3. Start the Site

    After this is complete, start up the Heat Clinic frontend by going into the site directory from the command line and executing:

    OSX/Linux

    $ ./startsite.sh
    

    Windows

    $ startsite.bat
    

    Once this has finished executing, you should be able to see the Heat Clinic by going to http://localhost:8080 in your browser


Next Steps

Now that you have Broadleaf up and running, here are some places you might go to next:


FAQ

Where is the Heat Clinic data stored? (Show Answer)

The Heat Clinic starts up with an embedded HSQL database, stored as a flatfile in the data directory of the root of the Heat Clinic project (this folder should be ignored from version control in your .gitignore file). You can browse this database with something like SquirrelSQL. You can also switch to another database to use Oracle, MySQL, Postgres or SQLServer.

Why did my data get wiped after a reboot? (Show Answer)

By default the Heat Clinic is configured to drop all tables and re-run import scripts on startup in the development runtime environment (the default for local development). In site/src/main/resources/runtime-properties/development.properties and also in admin/src/main/resources/runtime-properties/development.properties you will find these properties:

blPU.hibernate.hbm2ddl.auto=
blEventPU.hibernate.hbm2ddl.auto=
blSecurePU.hibernate.hbm2ddl.auto=
blEventPU.hibernate.hbm2ddl.auto=

There are 5 possible values for these properties:

  • validate - validate the database schema with the Hibernate data model, makes no changes to the database. Throws an exception if the database schema and the Hibernate model do not match
  • update - update the database schema with the Hibernate data model (e.g. add columns, foreign keys, tables). This will not change the underlying data inside the tables, but it is possible that you have invalid data after executing the update.
  • create - on startup, this executes a drop on all tables and data in the schema. Then all tables are re-created, and data load SQL is imported as specified by <unit_name>..hibernate.hbm2ddl.import_files like in development-shared.properties.
  • create-drop - on startup, do the same thing as the create value. On shutdown, drop the entire schema including all data and tables
  • none - do not do anything when comparing the Hibernate model to the database schema

Where does the Heat Clinic get all of its data for initial load? (Show Answer)

In the core project there is a set of SQL scripts that are executed. These scripts are in core/src/main/resources/sql. These SQL files are referenced as import files in core/src/main/resources/runtime-properties/development-shared.properties. Some Broadleaf add-on modules also add demo data. These files are referenced in the same common-shared.properties files, but they are prefixed by /config/bc/sql.

Why do I see error messages like 'HHH000389: Unsuccessful: alter table ...'? (Show Answer)

When the Heat Clinic first starts up, you might see a lot of these types of error messages in your logs:

[ERROR] 08:38:08 SchemaExport [admin][][] - HHH000389: Unsuccessful: alter table BLC_PAYMENT_LOG drop constraint FKA43703453E2FC4F9
[ERROR] 08:38:08 SchemaExport [admin][][] - user lacks privilege or object not found: PUBLIC.BLC_PAYMENT_LOG
[ERROR] 08:38:08 SchemaExport [admin][][] - HHH000389: Unsuccessful: alter table BLC_PAYMENT_LOG drop constraint FKA43703457470F437
[ERROR] 08:38:08 SchemaExport [admin][][] - user lacks privilege or object not found: PUBLIC.BLC_PAYMENT_LOG
[ERROR] 08:38:08 SchemaExport [admin][][] - HHH000389: Unsuccessful: alter table BLC_PGTMPLT_FLDGRP_XREF drop constraint FK99D625F66A79BDB5
[ERROR] 08:38:08 SchemaExport [admin][][] - user lacks privilege or object not found: PUBLIC.BLC_PGTMPLT_FLDGRP_XREF

This is a known bug that exists in Hibernate. This only occurs when the schema has never been created before and the hbm2ddl.auto is set to create or create-drop. These messages are harmless and can safely be ignored.

How do I shutdown or restart just the embedded HSQL database? (Show Answer)

In either the site or admin project, execute mvn antrun:run@hsqldb-stop. You can also start up the HSQLDB instance in either the site or admin projects with mvn antrun:run@hsqldb-start