Apache OfBiz Cookbook - Hoffman Ruth - E-Book

Apache OfBiz Cookbook E-Book

Hoffman Ruth

0,0
34,79 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Apache Open For Business (OFBiz) is an enterprise resource planning (ERP) system that provides a common data model and an extensive set of business processes. But without proper guidance on developing performance-critical applications, it is easy to make the wrong design and technology decisions. The power and promise of Apache OFBiz is comprehensively revealed in a collection of self-contained, quick, practical recipes in this Cookbook.

This book covers a range of topics from initial system setup to web application and HTML page creation, Java development, and data maintenance tasks. Focusing on a series of the most commonly performed OFBiz tasks, it provides clear, cogent, and easy-to-follow instructions designed to make the most of your OFBiz experience.

Let this book be your guide to enhancing your OFBiz productivity by saving you valuable time. Written specifically to give clear and straightforward answers to the most commonly asked OFBiz questions, this compendium of OFBiz recipes will show you everything you need to know to get things done in OFBiz.

Whether you are new to OFBiz or an old pro, you are sure to find many useful hints and handy tips here. Topics range from getting started to configuration and system setup, security and database management through the final stages of developing and testing new OFBiz applications.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB

Seitenzahl: 328

Veröffentlichungsjahr: 2010

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Apache OFBiz Cookbook
Credits
About the Author
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Getting Started
Introduction
Getting the project code
Getting ready
How to do it...
How it works...
There's more...
See also
Getting code from the Subversion repository
Getting ready
How to do it...
How it works...
See also
Fixing IP port collision errors
Getting ready
How to do it...
How it works...
There's more...
The JAVA_HOME setting
Getting ready
How to do it...
How it works...
There's more...
"Class Not Found" errors
Getting ready
How to do it...
How it works...
There's more...
Installation verification
Getting ready
How to do it...
How it works...
There's more...
SSL verification
Getting ready
How to do it...
How it works...
There's more...
See also
Running JUnit tests
Getting ready
How to do it...
How it works...
There's more...
Locating an OFBiz Component
Getting ready
How to do it...
How it works...
There's more...
Locating an OFBiz Application
Getting ready
How to do it...
How it works...
There's more...
2. Java Development
Introduction
Java runtime CLASSPATH
How to do it...
How it works...
Java compile time CLASSPATH
Getting ready
How to do it...
How it works...
Naming conventions
How to do it...
Writing OFBiz Java Events
Getting ready
How to do it...
How it works...
There's more...
Writing OFBiz Java Services
Getting ready
How to do it...
How it works...
There's more...
See also
Debugging using the logfile
Getting ready
How to do it...
How it works...
Calling OFBiz Services from a Java program
Getting ready
How to do it...
How it works...
There's more...
Getting and validating request parameters (Events)
How to do it...
How it works...
There's more...
Getting and validating request parameters (Services)
How to do it...
How it works...
Managing error messages
How to do it...
There's more...
Using Java properties files
How to do it...
How it works...
See also
Sending e-mail from an OFBiz Event or Service
Getting ready
How to do it...
How it works...
There's more...
See also
Handling XML files
Getting ready
How to do it...
How it works...
3. The User Interface
Introduction
Creating HTML web pages
Getting ready
How to do it...
How it works...
There's more...
Adding actions to Screen widgets
Getting ready
How to do it...
How it works...
There's more...
HTML markup in Screen widgets
How to do it...
How it works..
There's more...
CSS styling in Screen widgets
How to do it...
How it works...
There's more...
Platform-specific widgets
How to do it...
How it works...
There's more...
OFBiz Tree widgets
How to do it...
How it works...
There's more...
OFBiz Menu widgets
How to do it...
How it works...
OFBiz Form widgets
How to do it...
How it works...
There's more..
Creating web pages using FreeMarker
Getting ready
How to do it...
How it works...
There's more
See also
Passing Screen widget parameters to FreeMarker
How to do it...
How it works
There's more
Calling Java methods from FreeMarker
How to do it...
How it works...
There's more...
Forcing FreeMarker to render HTML markup
How to do it...
How it works
Uploading files in FreeMarker forms
Getting ready
How to do it...
How it works...
There 's more...
4. OFBiz Services
Introduction
Managing existing OFBiz Services
How to do it...
How it works...
There's more...
Calling a Service from an HTML form
Getting ready
How to do it...
How it works...
Calling asynchronous Services from HTML forms
Getting ready
How to do it...
How it works...
There's more...
Calling a Service many times from an HTML form
How to do it...
How it works...
Creating a new Service definition file
How to do it...
How it works...
Creating a new Service definition
How to do it...
How it works...
See also
Implementing Services
Getting ready
How to do it...
How it works...
There's more...
Defining Service attributes (INPUT/OUTPUT)
How to do it...
How it works...
Service Event Condition Actions
Getting ready
How to do it...
How it works...
There's more...
Service groups
Getting ready
How to do it...
How it works...
See also
Handling Service errors
Getting ready
How to do it...
How it works...
See also
Writing Groovy Services
Getting ready
How to do it...
How it works...
Mail Event Condition Actions
Getting ready
How to do it...
How it works...
See also
Entity Event Condition Actions
How to do it...
How it works...
There's more...
See also
5. The OFBiz Entity Engine
Introduction
Changing the default database
Getting ready
How to do it...
How it works...
See also
Connecting to a remote database
Getting ready
How to do it...
How it works...
Connecting to multiple databases
Getting ready
How to do it...
How it works...
Creating entity groups
Getting ready
How to do it...
How it works...
Disabling automatic database checks
Getting ready
How to do it...
How it works...
Mapping database data types
Getting ready
How to do it...
How it works...
Creating a new entity definition file
How to do it...
How it works...
Creating a new entity model
Getting ready
How to do it...
How it works...
There's more...
Modifying an existing entity model
Getting ready
How to do it...
How it works...
Building a view-entity
Getting ready
How to do it...
How it works...
There's more...
See also
6. OFBiz Security
Introduction
Securing communications ports
How to do it...
How it works...
There's more...
See also
Disabling demonstration user accounts
How to do it...
How it works...
Protecting OFBiz web pages
Getting ready
How to do it...
How it works...
There's more...
Creating user accounts
How to do it...
How it works...
There's more...
Protecting applications using security groups
How to do it...
How it works...
There's more...
Protecting views ("Tarpitting")
Getting ready
How to do it...
How it works...
There's more...
Retrieving forgotten passwords
Getting ready
How to do it...
How it works...
Changing your password
How to do it...
How it works...
Adding or changing SSL certificates
Getting ready
How to do it...
How it works...
There's more...
See also
OFBiz single sign-on and the external login key
Getting ready
How to do it...
How it works...
There's more...
7. WebTools
Introduction
Cache maintenance
Getting ready
How to do it...
How it works...
There's more...
See also
Changing debug settings
Getting ready
How to do it...
How it works...
There's more...
Exporting database data to XML documents
Getting ready
How to do it...
How it works...
Loading database(s) from XML documents
Getting ready
How to do it...
How it works...
There's more...
Managing internationalization labels
Getting ready
How to do it...
How it works
There's more...
Using the SQL processor
Getting ready
How to do it...
How it works...
Exploring the entity reference tool
Getting ready
How to do it...
How it works...
Viewing OFBiz usage statistics
Getting ready
How to do it...
How it works...
Uncovering artifact information
Getting ready
How to do it...
How it works...
Working with temporal expressions
Getting ready
How to do it...
How it works...
There's more...
8. Web Services
Introduction
Requesting web services using URL parameters
Getting ready
How to do it...
How it works...
There's more...
Requesting web services using an HttpClient
Getting ready
How to do it...
How it works...
There's more...
See also
Creating HttpClients and passing XML documents
Getting ready
How to do it...
How it works...
Creating XML-RPC web service clients
Getting ready
How to do it...
How it works...
See also
Becoming an XML-RPC web service provider
Getting ready
How to do it...
How it works...
See also
OFBiz SOAP messaging clients
Getting ready
How to do it...
How it works...
There's more...
Generating a WSDL document
Getting ready
How to do it...
How it works...
Creating SOAP-compliant web services
Getting ready
How to do it...
How it works...
9. OFBiz Tips and Tricks
Introduction
Fixing Java memory allocation errors
Getting ready
How to do it...
How it works...
There's more...
Reloading OFBiz seed and demo data
Getting ready
How to do it...
How it works...
There's more...
Creating new seed data files
Getting ready
How to do it...
How it works...
There's more…
Changing the administrative user's password
Getting ready
How to do it...
How it works...
There's more…
Creating a new administrative user
Getting ready
How to do it...
How it works...
There's more...
Getting the OFBiz version number
Getting ready
How to do it...
How it works...
There's more...
Building an OFBiz instance
Getting ready
How to do it...
How it works...
There's more...
See also
Building a single OFBiz Component
Getting ready
How to do it...
How it works...
Creating a new OFBiz Component or Application
Getting ready
How to do it...
How it works...
There's more...
Creating a FreeMarker transform
How to do it...
How it works...
There's more...
Preparing data using Groovy
Getting ready
How to do it...
How it works...
There's more...
See also
Pop-up new browser windows
How to do it...
How it works...
There's more...
Installing an OFBiz Visual Theme
Getting ready
How to do it...
How it works...
There's more...
Creating an OFBiz Visual Theme
Getting ready
How to do it...
How it works...
There's more...
See also
A. Entity Engine by Example
Introduction
Putting it all together with a data model example
Sample use case
Entity diagram
New entity definitions
2-way SQL join view-entity
3-way SQL join view-entity
View-entity reports
Next steps
Reading data from an OFBiz data source
Working with large result sets (EntityListIterator)
Removing data from the database (Java)
Writing data to the database (Java)
Using the automatic sequence generator
EntityUtil
EntityUtil.getFirst()
EntityUtil.filterByDate()
EntityUtil.orderBy()
EntityUtil.getFieldListFromEntityList()
EntityUtil.getRelated()
EntityUtil.filterByCondition()
EntityOperator reference
Index

Apache OFBiz Cookbook

Apache OFBiz Cookbook

Copyright © 2010 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: September 2010

Production Reference: 1020910

Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK.

ISBN 978-1-847199-18-8

www.packtpub.com

Cover Image by Harmeet Singh ( <[email protected]> )

Credits

Author

Ruth Hoffman

Reviewers

Adrian Crum

Shi Jinghai

Acquisition Editor

Chaitanya Apte

Development Editor

Rakesh Shejwal

Technical Editor

Vanjeet D'souza

Indexer

Hemangini Bari

Editorial Team Leader

Mithun Sehgal

Project Team Leader

Ashwin Shetty

Project Coordinator

Joel Goveya

Proofreader

Jonathan Todd

Graphics

Geetanjali Sawant

Production Coordinator

Arvindkumar Gupta

Cover Work

Arvindkumar Gupta

About the Author

Ruth Hoffman is an OFBiz evangelist with over 25 years of information technology experience, including stints in software design and development, training, project management, product marketing, and software sales, She has dedicated the last few years of her eventful career to furthering the OFBiz vision. Whether it be writing about OFBiz, providing implementation and OFBiz consulting services, or just "kicking the OFBiz tires" for each new release, she enjoys working with and telling the world about all that this amazing ERP software suite has to offer.

Ruth's current passion is her quest to provide high quality, cost effective OFBiz training and documentation. She has pursued this quest through multiple channels, including the OFBiz website. She invites everyone to stop by, take a gander, and give some feedback at http://www.myofbiz.com

As a long-standing supporter of OFBiz, she has authored several other OFBiz titles, including OFBiz E-Commerce Out-Of-The-Box and The OFBiz Catalog Manager. For more information, please see: http://www.myofbiz.com.

I would like to thank my partner, JC, for being so patient and understanding, my daughter for not getting too upset when I cancelled our planned Lilac Festival adventure, and my dog Sadie for sitting by me all those long hours when no one else would.

Also, my sincerest thanks go to Adrian Crum and Shi Jinghai for their dedicated efforts in providing technical reviews of this book. Thanks for keeping me honest and setting me straight on a number of occasions. Your contributions are greatly appreciated!

About the Reviewers

Adrian Crum is an IT Manager/Computer programmer for a company that builds homes. Prior to that, he owned and operated a computer retail/service/consulting business. He was Technical Editor of Coast Compute Magazine, and a contributing writer for Programmer's Journal. Adrian has been involved with the Apache OFBiz project as a contributing programmer since 2004, and he is a member of the Project Management Committee. His extensive experience in many programming languages and cross-platform development has been a key part of his contributions to the Apache OFBiz project.

Shi Jinghai graduated from Tsinghua University in 1991. In 2001, he took part in the China 2G Citizen Card Project and became an important system designer of the National Citizen Identity Information System of China. In 2004, he started his own company (Beijing Langhua Ltd.) focusing on IT services based on some excellent open source projects such as OFBiz, OpenCms, JBoss Portal, and Jasig CAS among others.

Preface

This book is designed to be read in any order, and is a collection of recipes found, by experience, to be most useful for developers working with the OFBiz project. Let it be your guide to enhancing your OFBiz productivity by saving you valuable time. Written specifically to give clear and straightforward answers to the most commonly asked OFBiz questions, this compendium of OFBiz recipes will show you everything you need to know to get things done in OFBiz.

Whether you are new to OFBiz or an old pro, you are sure to find many useful hints and handy tips here. Topics range from getting started, to configuration and system setup, security and database management, through the final stages of developing and testing new OFBiz applications. We are now Open For Business.

What this book covers

Chapter 1, Getting Started: If you already know how to get started with OFBiz then you can confidently skip this chapter. If, however, you are new to OFBiz, then you may find helpful hints in here to get you started, including getting a copy of the code from the download page or from the Subversion source code repository; fixing installation-related IP port collision errors; setting JAVA_HOME; fixing Java "Class Not Found" errors; installation verification; running JUnit tests; and some basic project artifact navigation hints, including where certain special directories (folders for Windows users) and files may be found.

Chapter 2, Java Development: OFBiz Java development starts with a clear understanding of the role of the Java CLASSPATH. In this chapter, learn how the CLASSPATH enables compilation and runtime loading of OFBiz artifacts. In addition, this chapter reveals how the OFBiz Java file-naming convention is helpful in organizing and finding Java source code. Also learn how to create OFBiz Events and Services, effectively use the provided Java debugging methods, call another OFBiz Service from within a Java program, access HTTP/HTTPS request parameters, use existing tools to handle error messages, use Java properties files, send e-mail using existing OFBiz Service(s), and manipulate XML documents using provided tools.

Chapter 3, The User Interface: Users interact with OFBiz—that is, the "User Interface"—through web pages often referred to within the project as "screens" or "screen views". In this chapter, see how web pages are built from the OFBiz Screen widget, including how to add actions, HTML markup, CSS, and other widgets (Tree, Menu, and Form widgets) to a single screen view widget definition. If your tastes run more towards creating your own screen views, see how to use FreeMarker templates inside Screen widget definitions to build (HTML) web pages. Also discussed in this chapter: passing parameters from the Screen widget's runtime context to the FreeMarker rendering engine, writing JavaScript and including it in a FreeMarker template, calling OFBiz Java methods directly from the FreeMarker context, forcing FreeMarker to render content with HTML markup at runtime, and how to upload a file—that is, support multipart HTML forms—in FreeMarker.

Chapter 4, OFBiz Services: OFBiz "Services" are reusable snippets of code that represent business processing or other logic. You write an OFBiz Service one time and invoke it anytime, anywhere and as often as needed. In this chapter, discover how to manage existing Services, invoke Services from an HTML form, and implement your own Service. Learn how Services communicate and interact during runtime operations using input and output attributes and triggers called Service Event Condition Actions, or SECAs. See best practices for handling errors within a Service and/or SECA. Also discussed are tips on implementing Services in languages other than Java, and a quick introduction to special SECA for incoming e-mail and operations on specific entities.

Chapter 5, The OFBiz Entity Engine: The OFBiz Entity Engine is the magic behind the database agnostic, data-driven tour-de-force that is OFBiz. In this chapter, see how to configure and use the Entity Engine to your advantage. Specifically, see how to change from the default Derby database to another database (note: throughout the OFBiz documentation, the term "data source" is used interchangeably with "database"); how to connect to remote and multiple databases; how entity groups work to help OFBiz organize access to multiple databases; and disable some system database startup checks, map new database field types, create your own entity definition file and entity definition, modify an existing entity definition—often referred to as the entity's model—and build view-entities that represent SQL join statements.

Chapter 6, OFBiz Security: What book about enterprise software would be complete without a word concerning security? In this chapter, get a quick introduction to securing your OFBiz instance, including recipes to lock down communication ports, disable demonstration accounts, protect web pages and web applications using OFBiz Security Groups, enable support for "tarpitting", retrieve forgotten passwords, change existing passwords, handle SSL certificates, and use OFBiz single sign-on support by way of the "external login key" feature.

Chapter 7, WebTools: Often lost in the OFBiz shuffle is a discussion covering basic usage of the many and varied tools that come with the project to manage your OFBiz instance. Collectively called "WebTools", this chapter looks at several important tasks easily accomplished using WebTools, including managing the cache, configuring system and application log tool settings for debug and troubleshooting support; exporting and importing database data; managing localization labels, and accessing databases using the SQL processor tool. Also discussed are introductions to the immensely useful Entity Reference Tool, finding and viewing OFBiz usage statistics, tracing OFBiz artifact dependencies, and working with temporal expressions.

Chapter 8, Web Services: With service orientation at the core of the OFBiz architecture, OFBiz is uniquely qualified to act as both a web services client and service provider for any number of web service interactions. In this chapter, learn how to act as a web services client and request service using URL parameter passing, HttpClient and XML document exchanges, and XML-RPC service requests. If you wish to provide web services, see how to set up OFBiz to serve XML-RPC services, generate and serve WSDL documents, and build both SOAP-based clients and services.

Chapter 9, OFBiz Tips and Tricks: This chapter is a collection of recipes that don't fit under other topic areas. Included here are hints on what to do if you run out of memory during OFBiz execution, reloading/reinitializing the OFBiz database, creating a new administrative user login and password, and getting the OFBiz version number (from Subversion checkouts or trunk builds only). Also included here are hints on using the provided ANT build tool to build an entire OFBiz instance, build a single OFBiz Component, and create a new OFBiz Component or Application. If you are looking for tips on creating a FreeMarker transformation, preparing data using Groovy, how to pop-up a new browser window, and OFBiz visual themes, you will find useful information here.

Appendix, Entity Engine by Example: In this Appendix, see how to effectively use the OFBiz Entity Engine to bring your OFBiz data drive applications to life. From the provided example data model, learn how to create entities and view-entities (SQL join statements) to implement a data model. Also, see how to read, remove, and write data to/from the database using the Entity Engine API; and use the provided EntityUtil API to manipulate database result-sets, access the automatic sequence generator to create new and unique sequence values, and see at a glance valid values for use with the Entity "Operator".

What you need for this book

To run the recipes mentioned in this book, you will need the following software:

Java Software Development Kit version 1.5 or greaterApache OFBiz release 9.04

Who this book is for

If you are an OFBiz user who has some familiarity with enterprise software systems and, perhaps more importantly, Internet and web exposure, you will be able to glean useful information from this book. For following some recipes, you will need only basic knowledge of modern browser behavior (for example, how to click a mouse button) while others assume only a passing familiarity with a text-editor and XML documents. If you are a software developer looking for Java and/or Groovy examples, this book also includes a chapter on Java software development.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Add one or more delegator elements to the datasource object".

A block of code is set as follows:

<field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java type="java.math.BigDecimal"> <validate method="isSignedDouble"/> </field-type-def> When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold: <field-type-def type="currency-amount" sql-type="NUMERIC(18,2)" java type="java.math.BigDecimal"> <validate method="isSignedDouble"/> </field-type-def>

Any command-line input or output is written as follows:

ant clean-install

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Use the WebTools Entity Reference - Interactive Version to see if the new view-entity was successfully created".

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <[email protected]>, and mention the book title via the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com, or e-mail <[email protected]>.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Getting Started

The OFBiz project is a collection of hundreds of directories and files, organized to allow for easy download, start-up, customization, and enterprise deployment.

In this chapter, we shall look at a number of commonly performed tasks related to setting up and running with OFBiz, including:

Getting the project codeGetting code from the Apache Subversion source code repositoryFixing IP port collision errorSetting the JAVA_HOME environment variableFixing "Class Not Found" errorsInstallation verificationSSL operational verificationRunning JUnit testsFinding an OFBiz Component's top-level directoryLocating an OFBiz Application

Introduction

OFBiz appeals to a remarkably diverse audience because of the breadth of solutions it enables. Whether you are a software developer or a business owner, you will find much to surprise, delight, and, most importantly use for your next enterprise software endeavor under the OFBiz umbrella.

In fact, there is so much to OFBiz that it is often difficult to know where to start. Unlike learning HTML or Java, OFBiz has no specification or authoritative source acting as the final arbiter of what works or is "correct". Rather, OFBiz is a well organized collection of "artifacts" that may, at the user's discretion, be mixed, matched, reorganized, and augmented with new artifacts to arrive at just about any business solution imaginable.

Just imagine an open source software project that includes:

Its own database schema and seed data already loaded and ready to run.An event-driven Service engine that enables code reusability across the entire instance. Services may be written in Java or any supported language, including Groovy, Bean Shell, JPython, and more.Hundreds of business logic workflow implementations ranging from a complete e-commerce Application to manufacturing and MRP, content management, user authentication, and authorization support all out-of-the-box and ready to use.Everything you need to serve up complete browser compliant User Interfaces (UI).And much more!

With all the possibilities that OFBiz brings to the table, where does one begin? From experience, the best way to get up and running quickly is to download the project code and start kicking the "tires". Use some of the suggestions in this book to help quickly experience some of the state-of-the-art tools, utilities, and complete Applications that are part of OFBiz out-of-the-box.

Always remember: there is no "right" or "wrong" way to doing anything with OFBiz.

Everything you need to get up and running quickly and with minimum fuss is packaged with the OFBiz distribution. That includes an integrated database, a ready to use web server, and all the network and communications infrastructure necessary to be up and running in minutes. All you need to do before you download OFBiz is:

Ensure that the prerequisite Java Software Development Kit (SDK) is installed. Please see the following table.Access to a reliable Internet connection.A modern browser handy to do some installation verification.

How do you know which version of Java to install? The following table summarizes available download options and necessary Java prerequisites:

Download title

Recommended usage

Minimum Java version

OFBiz version

apache-ofbiz-09.04.zip

Recommended for new users and those looking for the most stable project package.

Java 1.5

*

apache-ofbiz-4.0.zip

Legacy release. Not recommended for new users.

Java 1.4 or Java 1.5

 

"Nightly Trunk Builds"

ofbiz-trunk-current.zip

Project committers or users needing latest code. May not be stable or thoroughly tested!

These files are available on the "snapshots" download page.

Java 1.6

* *

Nightly trunk builds do not have release numbers.

* Nightly builds and version numbers represent bug fixes only.

* * "trunk" versions before January 2010, Java 1.5

Once OFBiz is downloaded and available locally on your hard drive, install it by "unpacking" it with your operating system's "unzip" tool.

Once unzipped, OFBiz is ready to run.

Tip

Looking for the Java SDK?

Most Java SDKs are available from Sun Microsystems at:

http://www.java.com/

MAC users will need to contact Apple directly or use the Software Update feature available on the Apple menu.

Getting the project code

Because OFBiz is more than just a few randomly organized files and directories, the collective and organized resources that go into making OFBiz, including the Apache infrastructure and software developers, are often called the "Project". The OFBiz project generates OFBiz code that is stored in a Subversion source code repository. It is a release and version of this code, extracted from the source code repository, built, and packaged using a "zip" archive tool, that we download as an OFBiz user.

Getting ready

Decide which version to download. It is recommended that new users download OFBiz Release 9.04. Experienced users and those wishing to contribute back to the project should consider starting with the latest version of the OFBiz source code "trunk". This code may be found on the Apache OFBiz "snapshot" web page.

Ensure you have the following necessary prerequisites in place:

A computer with a Java Virtual Machine (JVM) installed. If you are unsure of the version, please refer to the table provided in the introduction to this chapter.A modern browser (Internet Explorer, Firefox, Safari, Opera or the like).Internet connection with HTTP access to the OFBiz download website.

How to do it...

Apache OFBiz can be downloaded as shown in the following steps:

Using your browser, navigate to the Apache OFBiz download site (http://ofbiz.apache.org/download.html) to reveal the Download Apache OFBiz web page as shown:Use your browser to select the desired OFBiz release. New users are urged to download the release represented by the apache-ofbiz-09.04.zip file. At any point in time, this download represents the most stable release of OFBiz.Commence the download by clicking on the file link provided.

Tip

Note: The official OFBiz download website is often in a state of flux. At times, you may be directed to a mirror site before you are allowed to download any code. On other occasions, clicking the OFBiz download file will directly initiate the download. If you find this all very confusing, you are not alone. Feel free to comment on the official OFBiz mailing list and voice your opinion. More information about the OFBiz user mailing lists may be found here: https://cwiki.apache.org/confluence/display/OFBADMIN/Mailing+Lists

Once the download has completed, unpack OFBiz by running your operating system's unzip or equivalent command against the download file.Change directories to the OFBiz install directory and run the following ANT command to build the distribution and load the database: ant run-installAfter the ANT build script has completed, from the install directory run the appropriate OFBiz startup script provided for your operating system.Optionally, run tests to verify that everything is working

How it works...

OFBiz is packaged to include everything you need to run right out-of-the-box. Once your download is on your desktop, all you need do is unbundle it, build the distribution using the provided ANT tool, and start it up. No other configuration steps are necessary.

There's more...

There are a number of ways to start up OFBiz. Depending on your operating system environment and your proclivities towards working on the command line, you may:

Use one of the provided start up scriptsInvoke OFBiz from the command line directly or use the ANT build tool as shown here:

Windows

Unix

Command line

startofbiz.bat

startofbiz.sh

java -Xmx256M -jar ofbiz.jar

ant run

OFBiz runs inside and depends on a JVM. Before OFBiz can even start up, the JVM must be operational. The distribution provides all the tools necessary in the form of startup scripts to get the JVM up and running without any further work on your part.

For the curious, the following summarizes the OFBiz start-up sequence. This information is useful if you ever want to integrate third-party code or add your own Java programs to the OFBiz mix:

The Java Virtual Machine (JVM) is started from one of the available startup scripts or the command line.The OFBiz startup program (ofbiz.jar) is invoked as part of the JVM initialization.OFBiz loads all Components, builds the Java classpath, initializes communications, and verifies connections to one or more configured databases. While the OFBiz distribution includes the embedded Derby database, any number and combination of other databases may be configured.The embedded Tomcat http/https listener is started.OFBiz is up and running!

See also

For more information on prerequisites, getting the OFBiz code, and downloading and starting OFBiz up, please visit the What Do I Get? section on the following OFBiz web page: http://ci.apache.org/projects/ofbiz/snapshots/

Tip

Note: Be careful not to use the DOWNLOAD OFBIZ button on the snapshots download web page. Unless you want to download the latest OFBiz trunk nightly build, this button should not be confused with the DOWNLOAD OFBIZ button found on the official OFBiz loading web page: http://ofbiz.apache.org

Getting code from the Subversion repository

If you are planning to contribute back to the project or are just curious about downloading from the OFBiz source code control system, you may download a complete OFBiz package from the Subversion source code repository using the following procedure.

You will need a Subversion client, or an IDE with a Subversion client installed in order to access and download from Subversion.

Getting ready

Before you can download directly from the OFBiz Subversion repository, you must first have a Subversion client installed locally. Subversion clients come in several forms. The Subversion software comes with a command-line client and a command-line tool that facilitates checkout and download from a Subversion repository. This command is the co command.

Some users prefer to use built-in IDE (Integrated Development Environment) Subversion clients. One such client, Subclipse (http://subclpse.tigris.org), allows the user to checkout and install OFBiz from within the IDE using IDE-specific commands.

It goes without saying: you must also have an Internet connection with access to the OFBiz Subversion repository.

How to do it...

OFBiz source code can be downloaded from the Subversion repository by the following steps:

From a command-line window, type the following Subversion command:
svn co http://svn.apache.org/repos/asf/ofbiz/trunk ofbiz
Navigate to the install directory. If you used the above command, navigate to the ofbiz directory. For UNIX users, a command similar to the following is suggested:
cd ofbiz
Run the build script provided:
ant run-install

How it works...

OFBiz project source code is saved in a repository managed by the Subversion source code control system. Subversion uses a tree-like structure to organize and group together project artifacts, including source code. Each time a project developer commits an artifact to the repository, a new OFBiz version number is created, similar to a leaf on a tree. The project has had thousands of commits over its lifetime, hence the current version number is well on its way towards one million.

To request a version of OFBiz from the repository, a user issues a Subversion checkout command, co. A Subversion checkout fetches by default the latest leaf or version of the project from the Subversion code tree.

The OFBiz source code repository contains all previous versions of OFBiz. You may checkout any version at any time. Additionally, you may checkout "releases" of OFBiz where a "release" is a "branch" of the source code tree, by indicating your desire using the co command options.

Once the fetch from the repository is complete, you must run the OFBiz build script to build the project before running the OFBiz startup scripts. The build script rebuilds all included Java programs, rebuilds the runtime CLASSPATH, and checks and loads the database with seed and demonstration data.

See also

For more information on using Eclipse with the OFBiz Subversion repository, please refer to the following OFBiz Wiki page:

http://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse

For more information on Subversion, please refer to the Subversion website located at:

http://subversion.tigris.org

Fixing IP port collision errors

One of the most common OFBiz startup errors involves IP port collisions. OFBiz requires several Internet Protocol (IP) ports to run. All OFBiz downloads have these ports set to default values so that you may start up OFBiz without further configuration.

Occasionally, these default values are in conflict with IP ports used by other software already running on your system. If OFBiz cannot acquire the ports it needs to run, it will immediately shutdown and you will receive an error similar to the following on the command line (from which you started OFBiz):

(main) [ Http11Protocol.java:178:ERROR] Error initializing endpoint java.net.BindException: Address already in use: 8080

Getting ready

To remedy IP port conflicts, you may either turn off the software using the ports OFBiz needs or you can change the OFBiz configuration so that it uses ports not used by other software.

How to do it...

To change the OFBiz IP port configuration, perform the following:

Determine the port(s) that is/are in conflict by observing the console or command line window. Alternatively, you may view the primary OFBiz log file located in ~/runtime/logs/ofbiz.logLocate the OFBiz configuration file where the port is set.Edit the OFBiz configuration by changing the port number to a non-conflicting value.Restart OFBiz.

How it works...

For example, to fix collisions on port 8080, the IP port that OFBiz listens on for HTTP requests, navigate to the ofbiz-containers.xml file as shown in the following figure and change the value for port 8080 to another port not in use.

Tip

Note: Setting the HTTP port to a value between 1-1024 may require operating system administrative privileges in order to start up OFBiz. This is a constraint placed on these ports outside the control of OFBiz.

There's more...

The following is a list of IP port configuration file locators for reference:

Port #

Configuration file location relative to install directory

Port usage note

8080

~framework/base/config/ofbiz-containers.xml

Tomcat HTTP listener

 

~framework/webapp/config/url.properties

Internal HTTP port *

8443

~framework/base/config/ofbiz-containers.xml

Tomcat HTTPS listener

 

~framework/webapp/config/url.properties

Internal HTTPS port *

8009

~framework/base/config/ofbiz-containers.xml

AJP connector

9990

~framework/base/config/ofbiz-containers.xml

BeanShell remote telnet port

9991

~framework/base/config/ofbiz-containers.xml