History and lessons learned from a startup weekend. How I picked a FOSS e-commerce Java software and set-up a webshop in a weekend from ground zero. Including pushing it into the cloud.
Keeping your build tool updated in a multi repository world
Setting up a free open source java e-commerce website
1. Setting up a free Java e-commerce
webshop
(including cloud deployment)
For GDG Fresno
On 10/10/2014, Bitwise Industries,
Presented by Csaba Toth
2. Background
• Startup Weekend Fresno
• Event starts: Friday 5:30 PM, Sept. 5, 2014
• Event ends: Sunday 9:30 PM, Sept. 7, 2014
• Clock started sometimes around 10 PM on
Friday, I joined team Pro-Pack, a subscription
based dietary supplement company
• Clock effectively ended on 6 PM Sunday (final
product pitch)
3. E-commerce websites
• Saturday morning: searching for existing
solutions
– Java Pet Store Demo
– JadaSite http://www.jadasite.com/
– KonaKart http://www.konakart.com/
– Apache OFBiz https://ofbiz.apache.org/
– Broadleaf http://www.broadleafcommerce.org/
– …
4. Java Pet Store Demo
• Originally was an example for Java J2EE
• Can be beneficial to study the source
• Has payment module stub
• Has shipping module stub
• Demonstrates pure Java EE (no Spring
Framework)
5. Java Enterprise Edition Platform
• Extends the Java Standard Edition Platform
– ORM (Object Relationship Mapping) in the form of JPA
(Java Persistency API)
– Distributed and multi-tier architectures
– EJB support (Enterprise Java Beans)
– JMS (Java Messaging Services)
– CDI: Contexts and Dependency Injection
– JSF: Java Server Faces for front-end UI
– Web Services
• Modularity
• Many application servers which can host JEE apps
6. Java Enterprise Edition Platform
Specification Java EE 6[6] Java EE 7[3]
Servlet 3.0 3.1
JavaServer Pages (JSP) 2.2 2.3
Unified Expression Language (EL) 2.2 3.0
Debugging Support for Other Languages (JSR-45) 1.0 1.0
JavaServer Pages Standard Tag Library (JSTL) 1.2 1.2
JavaServer Faces (JSF) 2.0 2.2
Java API for RESTful Web Services (JAX-RS) 1.1 2.0
Java API for WebSocket (WebSocket) n/a 1.0
Java API for JSON Processing (JSON-P) n/a 1.0
Common Annotations for the Java Platform (JSR-250) 1.1 1.2
Enterprise JavaBeans (EJB) 3.1 Lite 3.2 Lite
Java Transaction API (JTA) 1.1 1.2
Java Persistence API (JPA) 2.0 2.1
Bean Validation 1.0 1.1
Managed Beans 1.0 1.0
Interceptors 1.1 1.2
Contexts and Dependency Injection for the Java EE Platform 1.0 1.1
Dependency Injection for Java 1.0 1.0
9. Three-tier/layer Architecture
• Three-tier
– Data
– Services / Business logic
– User Interface
• For data access: ORM
• For modular architecture and SOA:
Dependency Injection
• UI layer: often MVC technology, templating
engines
10. Architecture
UI client side
UI server side (MVC controllers and models)
EJBs Service Oriented Architecture
ORM: JPA, Hibernate, iBatis, etc.
DB
DAO
CDI
config
Configuration
UI layer
Services /
Middle /
Business
layer
Data
access
layer
JDBC
Data-base
Backing Beans, DTOs
11. Common properties
• Use of Java EE
• Maven: de-facto standard nowadays (Gradle is
coming up though)
– Declarative make/build system
– Suggest best-practice directory hierarchy (see later)
– Testing
– Deployment
– Documentation generation
– … everything!
12. Java Pet Store Demo
• https://github.com/stephanrauh/agoncal-petstore-
JSE7-ajax
– Technologies : BabbageFaces, PrimeFaces 5+,
Bootstrap, Angular JS, Java EE 6
• https://github.com/agoncal/agoncal-application-
petstore-ee6
– JSF front-end, also Java EE 6
• Application Servers : GlassFish 3.x, JBoss 7.x,
TomEE 1.x
13. JadaSite
• http://www.jadasite.com/
• http://www.jadasite.com/jada/web/fe/jadasite/English
/content/Documentation
• http://www.jadasite.com/jada/web/fe/jadasite/English
/content/Features
• Can be deployed on any J2EE application servers
including Apache Tomcat, Sun GlassFish, BEA Weblogic,
IBM Websphere, etc.
• Compatible with MySQL, SQLServer, Oracle database
server, etc.
• Template based design, with template editor
14. KonaKart
• http://www.konakart.com/
• All functionality is available through a set of APIs (POJO,
JSON, SOAP, RMI, JavaScript)
• JSP UI
• http://www.konakart.com/product/features/shopping-experience
• Apache Solr search
• FedEx UPS and USPS shipping modules, dozen of
payment modules
• Demo: http://www.konakart.com/konakart/
• Some of the core libraries and middleware are not open
source!
16. Broadleaf
• http://www.broadleafcommerce.org/
• Spring framework: provides dependency injection,
modularization framework. Also supports security, MVC UI,
etc.
• UI: earlier versions GWT, newer version Spring MVC
• Hibernate ORM layer, Oracle, MySQL, PostgreSQL, SQL
Server are supported
• Thymeleaf UI templating engine, integrated with Spring
MVC
• Apache Solr based search
• Spring enabled REST Service endpoints
• Demo site: http://demo.broadleafcommerce.org/
17. Broadleaf
• Source codes:
– The framework itself:
• https://github.com/BroadleafCommerce/BroadleafCommerce
– The demo site source code:
• https://github.com/BroadleafCommerce/DemoSite
– Pro-Pack site source code:
• https://github.com/MrCsabaToth/ProPackSource
• The demo sites have the broadleaf libraries as Maven
dependencies
• Disadvantage: demo sites cart checkout wasn’t mobile
compatible right out of the box
18. Moving into the cloud
• Amazon AWS: IaaS offering of Amazon
– tiny instance (small CPU 1GB memory, 8GB HDD)
– Ubuntu Server edition OS
– Getting cryptographic key for simple SSH login
– Configuring firewall and security policy
– Installing DB (MySql) and App Server (Tomcat)
• Main hurdles:
– App couldn’t access DB because of privileges
– JVM memory ran out: -Xmx was 128MB by default
19. Webshop
• Domain name from go.co, startup-weekend
promotion
• http://pro-pack.co/
• Also AWS credit for startup weekend
• New: the original VM went down, and I don’t
control the domain name, so it’s point’s to a
wrong IP
– Current webshop: http://54.183.117.8:8080/propack