Sunday, February 28, 2010

Drools JBoss Rules 5.0 Developer's Guide review

This book from Packt Publishing is the best one I have run across in 2009. Often they are a bit off the mark on order, cohesion and readability, but this one is spot on for business rules developers.

I think that this will become the bible for JBoss BRMS developers as it covers all the details you need to get your projects rolling.

After a very short introduction (as it should be, we are developers and want to get started), this book dives into the basic rules syntax and validation. You are then walked through the process of how to load facts into a knowledge session which is all about data transformation.

When dealing with rules we often have to make sure that the business users are not left out in the cold. The author take a good look at Domain Specific Language (DSL) implementation in Drools, decision tables and dealing with Drools Flow. These are all supported with examples and code to feed the developer learning how to make use of these elements of a rules implementation.

A walk through stateful sessions is followed by Complex Event Processing (CEP) with Drools Fusion and supported with a fraud detection example. This is really interesting and feeds me at the technical depth I expect from a developers guide.

There is an entire chapter spent on the details within Drools Flow and this is followed up with a sample application to walk you through all the details of setting up and executing a rules project. Testing is touched on briefly, along with some integration topics (Spring and the JSR94 standard). Finally, the book finishes up with a look at performance, providing you with insights to help you optimize your rules projects.

This book is well written, contains good technical depth and is very thorough. There is not much left for you to look for on JBoss with regards to your rules projects. You need this book on your development shelf if you are working with JBoss and rules in your organization.

JBoss Drools Business Rules review

I read this book early in 2009 when I was diving deeper into the JBoss Business Rules Management System (BRMS) and found it to be a good overview.

It is light on the technical depth, but this is not a problem and all crucial parts of the system are covered. It appeals to both business types and technical types trying to get a grasp of the Drools project components.

The book begins with a good introduction to rules and business rules in an organization, provides help with setting up your Drools environment and provides a tour of the following components in your business rules infrastructure:
  • Guvnor, the guided rule editor
  • JBoss IDE, the developers rule editing environment
  • Testing your rules
  • Managing your rules from Excel
  • Domain Specific Languages (DSL)
  • RuleFlow, graphical rule design
Furthermore, the book takes you through deploying rules in a real life situation and details how the rule engine works all the way down to the RETE algorithm.

This book is a very good place to start your JBoss Business Rules experience, whether you have done rules development before or not. It will get you up to speed on rules, is easy to read, well structured and before you know it you will be designing your first rules package.

Thursday, February 18, 2010

JBoss Developer Studio 3.0.0.RC1 optimizations

For those lucky customers out there that have been evaluating or playing with the customer releases of the up-coming 3.0.0 release, you might have noticed the default setup is a bit slow to start.

I was playing with my eclipse.ini file parameters and got mine to start 5x faster with these settings, maybe they will help you too:


JBoss Developer Studio performance optimizations (amazing speed improvements)

Working in a virtualized environment and very sick of the slow JBDS startups, we went looking for some help in the settings. Here is what we found:

The tricks is to use the optimization done in JDK 1.6 (VMarg2) and the new agresivity of the Just In Time compiler (JIT) for VMarg3. Add theses VM arguments to eclipse.ini (file is located in your Eclipse directory, one to each line)

What are these doing:
VMarg1 -XX:-UseParallelGC Use parallel garbage collection for scavenges. (Introduced in 1.4.1) this will create more threads running in parallel, so the second processor will be put in use
VMarg2 -XX:-UseConcMarkSweepGC Use concurrent mark-sweep collection for the old generation. (Introduced in 1.4.1) The Eclipse GUI will feel more responsive as memory will be reclaimed without blocking VM executions.
VMarg3 -XX:+AggressiveOpts Turn on point performance compiler optimizations that are expected to be default in upcoming releases. (Introduced in 5.0 update 6.)

JBoss Developer Studio / Eclipse debug ignores breakpoints fix

This week I ran into some of my Java projects where the debugging was ignoring breakpoints in my JBoss Develoepr Studio / Eclipse IDE's. I thought this was maybe just something in JBoss Developer Studio (JBDS), but it appears to be an issue with Eclipse too. 
This was the fix for me, in JBDS /Eclipse:
Window -> Preferences -> Java -> Installed JRE's:
  • edit JRE being used
    • edit 'Default VM Arguments' line
    • -XX:+UseParallelGC
Fixes it for me!

Friday, February 5, 2010

jBPM v3.2.x Hibernate persistence bug - missing javax.jcr.Node

While trying to show hibernate persistence with jBPM v3.2.x I ran into a problem with a missing dependency. Details of the simple POJO class I was persisting, the hibernate mappings, error message encountered and solution tracing are provided below for those interested:

package com.sample.model;

// Sample person object for persistence checking.
public class Person {

 private Integer ssn;
 private String lastname;
 private String firstname;

 public void setFirstname(String firstname) {
  this.firstname = firstname;
 public String getFirstname() {
  return firstname;
 public void setLastname(String lastname) {
  this.lastname = lastname;
 public String getLastname() {
  return lastname;
 public void setSSN(Integer ssn) {
  this.ssn = ssn;
 public Integer getSSN() {
  return ssn;

The hibernate mappings were put into the person.hbm.xml file:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
<hibernate-mapping package="com.sample.model" auto-import="false" default-access="field">
  <class name="Person">
   <id name="ssn" column="SSN"><generator class="native" /></id>
   <property name="lastname" column="LASTNAME" />
   <property name="firstname" column="FIRSTNAME" />

// First the errors I was getting in my logging (just the last bits):
DEBUG GraphElement - event 'process-start' on ProcessDefinition(main_flow)
 for Token(/)
DEBUG VariableContainer - create variable 'person' in 'TokenVariableMap[/]' 
with value 'com.sample.model.Person@1dfc547'
DEBUG Converters - adding converter 'D', 'org.jbpm.context.exe.converter.DoubleToStringConverter'
DEBUG Converters - adding converter 'C', 'org.jbpm.context.exe.converter.CharacterToStringConverter'
DEBUG Converters - adding converter 'B', 'org.jbpm.context.exe.converter.BooleanToStringConverter'
DEBUG Converters - adding converter 'Y', 'org.jbpm.context.exe.converter.BytesToByteArrayConverter'
DEBUG Converters - adding converter 'A', 'org.jbpm.context.exe.converter.DateToLongConverter'
DEBUG Converters - adding converter 'R', 'org.jbpm.context.exe.converter.SerializableToByteArrayConverter'
DEBUG Converters - adding converter 'I', 'org.jbpm.context.exe.converter.IntegerToLongConverter'
DEBUG Converters - adding converter 'H', 'org.jbpm.context.exe.converter.ShortToLongConverter'
DEBUG Converters - adding converter 'G', 'org.jbpm.context.exe.converter.FloatToDoubleConverter'
DEBUG Converters - adding converter 'F', 'org.jbpm.context.exe.converter.FloatToStringConverter'
DEBUG Converters - adding converter 'E', 'org.jbpm.context.exe.converter.ByteToLongConverter'
DEBUG HibernateLongIdMatcher - no current context so valueClass 
cannot be stored as a long-id-ref to a hibernate object
DEBUG HibernateStringIdMatcher - no current context so valueClass 
cannot be stored as a string-id-ref to a hibernate object

The path to the missing interface we traced from jbpm-jpdl.jar -> org.jbpm.context.exe -> jbpm.varmapping.xml file contains the following mapping:

<!-- JSR 170 JCR Node -->
        <bean class="org.jbpm.context.exe.matcher.JcrNodeMatcher" />
      <variable-instance class="org.jbpm.context.exe.variableinstance.JcrNodeInstance" />

This leads to org.jbpm.context.exe.matcher.JcrNodeMatcher.class which imports the class not included in jBPM:

 * Snipped the license code.
package org.jbpm.context.exe.matcher;

import javax.jcr.Node;        <<<<<<<<<<<<<< MISSING!!!!

import org.jbpm.context.exe.JbpmTypeMatcher;

public class JcrNodeMatcher implements JbpmTypeMatcher {

  private static final long serialVersionUID = 1L;

  public boolean matches(Object value) {
    return (Node.class.isAssignableFrom(value.getClass()));


My solution: added external jar to projects classpath, jcr-1.0.jar which provides the needed interface interface. Hope this saves you some time!

Thursday, February 4, 2010

Upgrade Fedora 11 to Fedora 12 howto

A few simple steps to upgrade:

# As root you would like to have a clean start to the
# upgrade, so get an update out of the way.
$ yum update rpm

$ yum -y update

$ yum clean all

# Should a new kernel install/update require it,
# reboot before continuing with the rest.
# Then install the preupgrade package.
$ yum install preupgrade

# For console upgrade, use:
$ preupgrade-cli "Fedora 12 (Constantine)"

# If you like gui's to upgrade, use this.
$ preupgrade

This is exactly the same process as I previously described with Fedora 10 to Fedora 11 upgrade.

Tuesday, February 2, 2010

Update Fedora 12 to Firefox 3.6 howto

I got tired of waiting for the main Fedora 12 repositories to provide Firefox 3.6. I dug around a bit and the following will get you a Firefox 3.6 version installed on your Fedora 12, so what are you waiting for?

$ sudo yum --enablerepo=rawhide update firefox