9 Replies Latest reply on Aug 17, 2011 8:15 AM by Miguel Behr

    jBPM 4.x on Glassfish

    Patryk Porebski Newbie

      Hello,

       

      I've been trying to use jBPM in my Netbeans project based on Glasfish for several days without luck. Looked for info everywhere, but (which is suprising for me) there is not a lot of docs out there.

       

      So my question is:

      1) Is it possible to include jBPM in an JEE 5 application in any other JEE server than jBoss or Tomcat?

      2) If it is (which I suppose should be - this is Java for god's sake ) what are the steps to get it working?

       

      I did these:

      1) included jbpm.jar in my project,

      2) put all configuration files (jbpm.cfg.xml, jbpm.hibernate.cfg.xml, jbpm.mail.properties, logging.properties) in my class path

      3) created database, schema and user for jbpm

      4) wrote a code like this:

       

       

      import org.apache.log4j.Logger;

      import org.jbpm.api.Configuration;

      import org.jbpm.api.ProcessEngine;

      import org.jbpm.api.RepositoryService;

       

      public class Test {

       

          private static Logger log = Logger.getLogger(Test.class.getName());

          private static ProcessEngine processEngine = null;

          private static RepositoryService repositoryService = null;

       

       

          public Test()

          {

          }

       

          public void testuj()

          {

                log.trace("Entering tests!!!");

                if(processEngine==null)

                {

               log.trace("processEngine to be initialized");

              processEngine = new Configuration().buildProcessEngine();

               log.trace("processEngine initialized");

               repositoryService = processEngine.getRepositoryService();

               log.trace("repositoryService retrieved");

           }

           else

           {

               log.trace("processEngine already initialized");

           }

           log.trace("Got processEngine "+processEngine);

           log.trace("Got repositoryService "+repositoryService);

       

           log.trace("finished");

      }

       

      }

      The result - app is getting deployed for the first time.
      When I invoke testuj() I get log message in the console "processEngine to be initialized" - and nothing more after that.
      Log4j also logs to the file - I look there - everything is logged there until "finished"
      I tried also to invoke some actions to see if database connetion is ok and yes, it's ok.
      What is strange that if I change a single line and redeploy application Glassfish says it can't find a resource and nothing is thrown in the console.
      Console is like frozen after the message "processEngine to be initialized" - nothing shows there since then.
      Tried thousands times and everything says that something wrong is happening in Configuraton().buildProcessEngine...
      Thanks for your help!
      pa3k
      P.S.
      I tried to use jBPM 3.2 with glassfish and it worked ok (without database), but I want to use the latest version available.
        • 1. Re: jBPM 4.x on Glassfish
          M Porter Newbie

          Yes it is possible. We are running it on WLS 10.3 for example. Although its pretty much a 'figure out how to do it yourself' approach (i.e trial and error). The problem is that jBPM is mainly designed to run on JBoss of course so you might want to use JBoss to make your life easier !. In this case the engine is bound to JNDI for you for example (we had to implement this ourself manually).

           

          Are you including all the dependant libraries (in the \lib folder) in your classpath also. I would try 4.1 as 4.2 broke our processes althrough this is fixed in the latest truck.

          • 2. Re: jBPM 4.x on Glassfish
            Ronald van Kuijk Master

            jBPM is not designed to "mainly run on JBoss". What is not done by the core team is try to find all possible combinations of libraries that are needed for all other appservers. If the core of jBPM contains an issue that only manifests itself on other appservers and can be fixed without breaking other appservers that will surely be done.

             

            The JNDI stuff is not needed if you do not want it. That only comes in if you want to run it generically on a server. If you package jBPM in your ear, you can do without.

            • 3. Re: jBPM 4.x on Glassfish
              Ronald van Kuijk Master
              Do you have more logging on what is going on IN jbpm when the processEngine is being build. Without that it is realy hard for us to help out.
              • 4. Re: jBPM 4.x on Glassfish
                Patryk Porebski Newbie

                The problem is that logging hangs after Configuration().buildProcessEngine() and nothing shows in the console.

                 

                I tried to get debug logging from jbpm but nothing was shown.

                 

                I'm lost with this. I've tried everything.

                 

                Everything is fine until I use jbpm. The worst thing is that every time I call buildProcessEngine I need to restart my App Server to get it back to work.

                 

                 

                Anyone faced that issue?

                • 5. Re: jBPM 4.x on Glassfish
                  Yogita Bartake Newbie

                  Hi,

                   

                  I am facing the exact same issue and have been stuck with it for quite some time now..

                  In the glassfish server log  I get the following output

                   

                  "Exception occured while UserTraceLogging: java.lang.NullPointerException"

                   

                  for the line....

                  processEngine = new Configuration().buildProcessEngine();

                   

                  I even tried using the following directly but gives the same output


                  new Configuration().setResource("jbpm.cfg.xml").buildProcessEngine();

                   


                  Even a hint of how I can start looking for the root cause would be appreciated.

                  Thanks!!!

                   

                  • 6. Re: jBPM 4.x on Glassfish
                    Yogita Bartake Newbie

                    We are facing the below error on Glassfish V2 with JBPM 4.1.

                     

                    java.lang.IllegalStateException: Operation not allowed.
                    at com.sun.enterprise.distributedtx.UserTransactionImpl.checkUserTransactionMethodAccess(UserTransactionImpl.java:135)
                    at com.sun.enterprise.distributedtx.UserTransactionImpl.getStatus(UserTransactionImpl.java:262)
                    at org.jbpm.pvm.internal.tx.jta.JtaTransaction.getUserTransactionStatus(JtaTransaction.java:144)
                    at org.jbpm.pvm.internal.tx.jta.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:43)
                    at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:46)
                    at org.jbpm.pvm.internal.svc.ExecutionServiceImpl.startProcessInstanceByKey(ExecutionServiceImpl.java:66)

                     

                    Hibernate configuration is as below.

                     

                    <property name="hibernate.search.worker.execution">async</property>
                      <property name="hibernate.search.worker.buffer_queue.max">5</property>
                      <property name="hibernate.search.worker.thread_pool.size">5</property>
                      <property name="hibernate.transaction.flush_before_completion">true</property>
                      <property name="hibernate.transaction.auto_close_session">true</property>
                      <property name="jta.UserTransaction">java:comp/UserTransaction</property>
                      <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
                      <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.SunONETransactionManagerLookup</property>
                      <property name="hibernate.connection.provider_class">org.hibernate.connection.DatasourceConnectionProvider</property>
                      <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>

                      <property name="hibernate.connection.url">jdbc:oracle:thin:@10.141.152.34:1521:XA</property>
                      <property name="hibernate.connection.username">****</property>
                      <property name="hibernate.connection.password">****</property>

                    <property name="hibernate.show_sql">true</property>
                    <property name="hibernate.format_sql">true</property>
                    <property name="hibernate.hbm2ddl.auto">update</property>
                    <property name="current_session_context_class">thread</property>

                    <mapping resource="jbpm.repository.hbm.xml" />
                      <mapping resource="jbpm.execution.hbm.xml" />
                      <mapping resource="jbpm.history.hbm.xml" />
                      <mapping resource="jbpm.task.hbm.xml" />
                    <mapping resource="jbpm.identity.hbm.xml" />

                     

                    We have tried adding jta.UserTransaction property in the jbpm.hibernate.cfg.xml file without any luck. Please let us know if there is any solution to this.

                     

                    Thanks

                    • 7. Re: jBPM 4.x on Glassfish
                      Shambhu Kumar Sinha Newbie

                      Hi,

                      This related with following link

                      http://community.jboss.org/thread/159944?tstart=0

                       

                      Can anyone please let me know if there is anything that I need to do here to fix this issue.

                       

                      Thanks,

                      Shambhu

                      • 8. Re: jBPM 4.x on Glassfish
                        reidz Newbie

                        i have same issue here, since 27 Dec '10 (post before me) and still no hint or something

                        so i assume JBPM 4.4 just wont run on Glassfish

                        i got same error when i run this code below and i already have jbpm.cfg.xml in my root classpath

                         

                        va.lang.NullPointerException"

                         

                        for the line....

                        processEngine = new Configuration().buildProcessEngine();

                         

                        any help or hint ?

                        • 9. Re: jBPM 4.x on Glassfish
                          Miguel Behr Newbie

                          Hi, somebody know how configure jbpm on glassfish?

                           

                          thanks