3 Replies Latest reply on Mar 24, 2007 2:08 PM by Chris Russell

    Deploying jbpm-enterprise.ear from jbpm-jpdl-suite-3.2.Beta1

    Chris Russell Newbie

      Rather than using the "out of the box" jboss as delivered with jbpm 3.2.Beta1, I would like to deploy the ear delivered in the deploy directory to my jboss as with ejb3 and messaging enabled.
      Has anyone had any experience with this?
      I have had limited success and ultimately the jbpm-console seems to work but never actually logs me in just tells me the login failed.
      Documentation on this subject seems very limited and fragmented.

      The only hint I get when deploying the ear is that there may be some compatibility issue with JSF packaged with the jbpm-console and the default jboss as's.
      Log Hint
      13:00:14,334 ERROR [STDERR] Jan 17, 2007 1:00:14 PM com.sun.faces.config.ConfigureListener contextInitialized
      INFO: Initializing Sun's JavaServer Faces implementation (1.2_03-b09-FCS) for context 'null'
      13:00:14,650 ERROR [STDERR] Jan 17, 2007 1:00:14 PM com.sun.faces.spi.InjectionProviderFactory createInstance
      WARNING: JSF1033: Resource injection is DISABLED.

      Otherwise everything seems to load fine.
      Below are my notes on how to do this so far but am at an impasse and could really use some help. If I get all the steps put together correctly I would gladly contribute them "unless it turns out that I have been a total boob".

      DEPLOYING JBPM TO AN EXISTING JBOSS SERVER
      ==========================================
      Philosophy. I know that the starter kit includes a preconfigured jboss but that is not good enough.
      We have to be able to deploy jbpm, drools, and jboss messaging for production servers (hell for development too).
      The download site for jbpm has a "suite" 3.2.beta1 that it seems to be touting as the next great thing so
      I have used a combination of the starter kit and the suite to come to all the following conclusions.

      Downloaded jbpm-jpdl-suite-3.2.Beta1.zip
      unzip it. (call this unzipped dir $suite)
      Under there there is a deploy directory that contains the jbpm ear we want to deploy.
      $suite/deploy/jbpm-enterprise.ear
      In there there is a jbpm-enterprise.ear which contains (in theory) a complete deployable ear
      that includes jbpm, jbpm-identity, jbpm-console.

      On deploying this beast however I ran into many issues.
      There does not seem to be any good documentation on how to actually deploy this but here is what I learned from
      watching the jboss logs.
      I think I am close to getting this to work but the console app just wont let me log in.

      JBPM REQUIRED MESSAGE QUEUE (JBOSS CONFIG CHANGE)
      =================================================
      1. When deployed logs showed need for a message queue. So I just added one identical to the one added for
      the appentity.

      /usr/local/jboss/server/messaging/deploy/jboss-messaging.sar/destinations-service.xml
      <!--I ADDED THIS-->
      <mbean code="org.jboss.jms.server.destination.Queue"
      name="jboss.messaging.destination:service=Queue,name=JbpmCommandQueue"
      xmbean-dd="xmdesc/Queue-xmbean.xml">
      <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer








      This cleared up that error.
      Note that I had to create a queue named JbpmCommandQueue first.
      Then I was able to go to http://localhost:8080/jbpm-console/
      and the web service seemed to start ok. took me to a login screen.

      I'm sure that within the ear we could put a jbpm-service.xml file with this queue definition
      but I knew it would work editing the default jboss one so I did that.


      JBPM SECURITY DOMAIN (JBOSS CONFIG CHANGE)
      ==========================================
      Now when I deploy I start seeing in the jboss log.
      ERROR [UsersRolesLoginModule] Failed to load users/passwords/role files

      After a lot of googleing I found a few hints here:
      Describes the error with users.properties
      http://www.magnolia.info/wiki/Wiki.jsp?page=MagnoliaJBossAndJAAS

      ERROR [UsersRolesLoginModule] Failed to load users/passwords/role files

      WHAT THIS TOLD ME was that the security domain that jbpm-console and jbpm-identity module uses
      was not correct.

      If you look at expand/jbpm-console-war/WEB-INF/jboss-web.xml it looks like this:
      ---------------------------------------------
      <?xml version="1.0" encoding="UTF-8"?>



      <jboss-web>

      <security-domain>java:/jaas/other</security-domain>

      </jboss-web>

      ---------------------------------------------
      So the jbpm-console is using the security domain other.
      Therefore we need for the security domain other config to look like that sent in the
      preconfigured jbpm starter kit server so I copied the following from the
      starter kit/server/jbpm/conf/login-config.xml

      Forced me to edit /usr/local/jboss/server/messaging/conf/login-config.xml
      Changed the definition of the application-policy "other" to match that found
      int the jbpm configured server.

      <application-policy name = "other">
      <!-- A simple server login module, which can be used when the number
      of users is relatively small. It uses two properties files:
      users.properties, which holds users (key) and their password (value).
      roles.properties, which holds users (key) and a comma-separated list of
      their roles (value).
      The unauthenticatedIdentity property defines the name of the principal
      that will be used when a null username and password are presented as is
      the case for an unuathenticated web client or MDB. If you want to
      allow such users to be authenticated add the property, e.g.,
      unauthenticatedIdentity="nobody"
      -->

      <!-- RUSSELL added this to match the jbpm server config given. Changed JbpmDS to DefaultDS so we can see stuff.-->

      <login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
      flag="required">
      <module-option name="dsJndiName">java:/DefaultDS</module-option>
      <module-option name="principalsQuery">
      SELECT PASSWORD_ FROM JBPM_ID_USER WHERE NAME_=?
      </module-option>
      <module-option name="rolesQuery">
      SELECT g.NAME_ ,'Roles'
      FROM JBPM_ID_USER u,
      JBPM_ID_MEMBERSHIP m,
      JBPM_ID_GROUP g
      WHERE g.TYPE_='security-role'
      AND m.GROUP_ = g.ID_
      AND m.USER_ = u.ID_
      AND u.NAME_=?
      </module-option>
      </login-module>

      </application-policy>

      <!-- RUSSELL remove for now.

      <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
      flag = "required" />

      </application-policy>
      -->

      This would seem to make sense and wa la, when we deploy now we dont see the
      error about user.properties as before.
      Which leads us to the other bofongoo. Particularly the initial creation of all the jbpm tables
      including the identity tables. Please see CREATING JBPM AND IDENTITY TABLES.


      MAKE JBPM USE OUR STAND ALONE HSQLDB INSTEAD OF inmemory. (JBPM EAR CONFIG CHANGE)
      ===================================================================================
      copy the jbpm-enterprise.ear to this directory.
      ant expand
      edit expand/lib/jbpm-configs-jar/hibernate.cfg.xml
      <!-- RUSSELL DID THIS -->
      <!--property name="hibernate.connection.datasource">java:/JbpmDS</property-->
      java:/DefaultDS
      <!-- DataSource properties (end) -->

      <!-- RUSSELL UNCOMMENTED THIS logging properties (begin) === -->
      true
      true
      true
      <!-- ==== logging properties (end) -->
      (Ultimately I hope we are just telling jbpm to use the DefaultDS here)
      ant build
      sudo ant deploy.


      CREATING JBPM AND INDETITY TABLES IN OUR STAND ALONE HSQLDB
      ===========================================================
      copied $dir/db/jbpm.jpdl.hsqldb.sql to /home/hsqldb
      Then as hsqldb run the java -cp lib/hsqldb.jar org.hsqldb.util.DatabaseManagerSwing
      And connected to Server mode localhost:1701 (Jboss's instance).
      Then load and execute the script to get the schema loaded into jboss for jbpm.
      All the tables are named JBPM_*.
      Note I had to remove all the ALTER commands in the begining of the script since none of the tables initially exist.
      Now I dont think the identity component schema is added though.

      However, this script does not seem to include the identity tables.
      So I mutated a copy of $starter-kit/jbpm-db/hsqldb/upgrade.scripts/hsqldb.create.jbpm.3.1.sql which does
      create them.
      However, the identity component loaded with jbpm-enterprise.ear seems to be defaulting to
      text file based stuff.

      SO IN THE END I HAVE CREATED SOME SQL SCRIPTS THAT CAN BE RUN FROM
      SQUIRRELL because it would seem that the $suite does not include creates for identity and note
      also that you need to config squirrell session properties to not abort on error.

      # Create or remove the core jbpm tables, indexes, and constraints
      # these were extracted from the ~/jbpm-jpdl-3.2.Beta1/db/jbpm.jpdl.hsqldb.sql
      create-jbpm.sql
      remove-jbpm.sql

      # Create or remove the identity jbpm tables, indexes, and constraints
      # This sql extracted from jbpm-starters-kit/jbpm-db/hsqldb/upgrade.scripts/hsqldb.create.jbpm.3.1.sql
      create-identity.sql
      remove-identity.sql

      # Create the sample users for the jbpm-console app (bert, ernie, etc).
      identity-users.sql

      Chapter 8 of the users guide on DB crap says

      Making the default webapp talk to the correct datasource is again not very difficult. The first step in doing this is simply locate the 'jboss-service.xml' file in the folder '${JBPM_SDK_HOME}/jbpm-server/server/jbpm/deploy/jbpm.sar/META-INF'. Change the contents of this file with the contents of the listing below. An attentive reader will notice that the only difference is an exchange of the token 'DefaultDS' by 'JbpmDS'.
      <?xml version="1.0" encoding="UTF-8"?>


      java:/jbpm/JbpmConfiguration
      jboss.jca:service=DataSourceBinding,name=DefaultDS



      But hey, in the jbpm-enterprise.ear there does not seem to be such a beast. Not sure how to force this
      or if they associate a jndi name with. However since we changed the jbpm-configs jar to use DefaultDS as above,
      I assume we are ok there.

      I can post the sql scripts if that helps but I'm just not seeing any access to sql as though trying to log in is failing before any queries are issued.

        • 1. Re: Deploying jbpm-enterprise.ear from jbpm-jpdl-suite-3.2.B
          Vinicius Carvalho Apprentice

          Hello there! Did you succeed on this procedure? I'm really getting upset with jbpm and its "documentation"..

          • 2. Re: Deploying jbpm-enterprise.ear from jbpm-jpdl-suite-3.2.B
            Ronald van Kuijk Master

            this procedure is correct (for as far as I can see by looking at it, not tring it) upto the last part. The docs are indeed wrong where they describe changing the database. Just change hibernate.cfg.xml in the jar that is in the ear.

            • 3. Re: Deploying jbpm-enterprise.ear from jbpm-jpdl-suite-3.2.B
              Chris Russell Newbie

              Yea some success. I have some better distilled down notes I will try to add.
              Still a rather frustrating solution. I wish at least we could see some more info on release timelines and more docs.
              I basically had to drop back to compiling from source since I was making some changes to allow annotated classes to be persisted (my classes not using class-name.hbm.xml style persistence descriptors). There is a jira item on this and I think they will include the change to an AnnotatedConfiguration which will allow statements like:

               <mapping class="com.mycompany.entity.MyClass"/>
              

              in hibernate.cfg.xml.
              Here is an ant build script you can use to expand and contract the jbpm-enterprise.ear so that you can edit the hibernate.cfg.xml
              just ant expand
              make your edits
              ant build
              <project name="hpfm-jbpm">
              
               <property name="basedir" value="."/>
               <property name="built.dir" value="${basedir}/built"/>
               <property name="expand.dir" value="${basedir}/expand"/>
               <property name="jboss.deploy.dir" value="/usr/local/jboss/server/messaging/deploy"/>
              
              
               <target name="clean">
               <delete dir="${built.dir}" />
               </target>
              
               <target name="prepare">
               <mkdir dir="${built.dir}" />
               <mkdir dir="${expand.dir}" />
               </target>
              
               <target name="expand" description="expand ear into the expand dir" depends="prepare">
               <!-- UNZIP THE EAR FILE -->
               <unzip src="${basedir}/jbpm-enterprise.ear" dest="${expand.dir}" />
              
               <mkdir dir="${expand.dir}/jbpm-console-war" />
               <unzip src="${expand.dir}/jbpm-console.war" dest="${expand.dir}/jbpm-console-war" />
              
               <mkdir dir="${expand.dir}/jbpm-enterprise-jar" />
               <unzip src="${expand.dir}/jbpm-enterprise.jar" dest="${expand.dir}/jbpm-enterprise-jar" />
              
               <mkdir dir="${expand.dir}/lib/jbpm-configs-jar" />
               <unzip src="${expand.dir}/lib/jbpm-configs.jar" dest="${expand.dir}/lib/jbpm-configs-jar" />
              
               <mkdir dir="${expand.dir}/lib/jbpm-identity-jar" />
               <unzip src="${expand.dir}/lib/jbpm-identity.jar" dest="${expand.dir}/lib/jbpm-identity-jar" />
              
               <mkdir dir="${expand.dir}/lib/jbpm-jpdl-jar" />
               <unzip src="${expand.dir}/lib/jbpm-jpdl.jar" dest="${expand.dir}/lib/jbpm-jpdl-jar" />
              
               </target>
              
              
              
               <target name="contract" description="remake all the parts to the parts directory" depends="prepare">
              
               <!-- ZIP CONTENTS OF THE EXPAND/LIB DIRECTORY-->
              
               <zip destfile="${expand.dir}/lib/jbpm-jpdl.jar">
               <fileset dir="${expand.dir}/lib/jbpm-jpdl-jar" />
               </zip>
              
               <zip destfile="${expand.dir}/lib/jbpm-identity.jar">
               <fileset dir="${expand.dir}/lib/jbpm-identity-jar" />
               </zip>
              
               <zip destfile="${expand.dir}/lib/jbpm-configs.jar">
               <fileset dir="${expand.dir}/lib/jbpm-configs-jar" />
               </zip>
              
               <!-- ZIP CONTENTS OF THE EXPAND DIRECTORY-->
              
               <zip destfile="${expand.dir}/jbpm-enterprise.jar">
               <fileset dir="${expand.dir}/jbpm-enterprise-jar" />
               </zip>
              
               <zip destfile="${expand.dir}/jbpm-console.war">
               <fileset dir="${expand.dir}/jbpm-console-war" />
               </zip>
              
               </target>
              
              
              
              <!--
               <target name="build" depends="prepare, make-parts">
               <ear destfile="${built.dir}/jbpm-enterprise.ear" appxml="${parts.dir}/META-INF/application.xml">
               <fileset dir="${parts.dir}">
               <exclude name="META-INF/application.xml" />
               </fileset>
               </ear>
               </target>
               -->
              
               <target name="build" depends="prepare, contract">
               <ear destfile="${built.dir}/jbpm-enterprise.ear" appxml="${expand.dir}/META-INF/application.xml">
               <fileset dir="${expand.dir}" includes="*.war,*.jar,lib/*.jar" >
               <!--
               <exclude name="META-INF/application.xml" />
               <exclude name="jbpm-enterprise-jar" />
               <exclude name="jbpm-console-war" />
               <exclude name="lib/jbpm-identity-jar" />
               <exclude name="lib/jbpm-configs-jar" />
               <exclude name="lib/jbpm-jpdl-jar" />
               -->
              
               </fileset>
               </ear>
               </target>
              
              
               <target name="deploy" depends="build">
               <copy file="${built.dir}/jbpm-enterprise.ear" todir="${jboss.deploy.dir}"/>
               </target>
              
              
              </project>