1 Reply Latest reply on Jan 17, 2014 8:37 AM by Marshal Lee

    Start jbpm6.0 on jetty-distribution-7.6.13.v20130916

    Marshal Lee Newbie

      about jetty container :

      CALL bitronix.tm.integration.jetty7.BTMLifeCycle in jetty.xml,remove related in \jbpm\META-INF\context.xml.

      CALL bitronix.tm.TransactionManagerServices  in jetty.xml,remove related btm-config.properties in tomcat\ conf.

      Add LoginService in jetty.xml ,set the name same as in web.xml.

      NEW bitronix.tm.resource.jdbc.PoolingDataSource named "jdbc/jbpm".

       

      add .jar in jetty/lib/ext

      such as BTM.jar,javax.transaction.jar,slf4j-ext.jar..........etc

       

      in .war:

      create jetty-context.xml and jetty-env.xml in jbpm\WEB-INF

      claim BeanManager and ErraiService

      =================================================================

      <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"

         "http://www.eclipse.org/jetty/configure.dtd">

      <Configure id="webAppCtx" class="org.eclipse.jetty.webapp.WebAppContext">

          <New id="BeanManager" class="org.eclipse.jetty.plus.jndi.Resource">

              <Arg> <Ref id="webAppCtx"/> </Arg>

              <Arg>BeanManager</Arg>

              <Arg>

                  <New class="javax.naming.Reference">

                      <Arg>javax.enterprise.inject.spi.BeanManager</Arg>

                      <Arg>org.jboss.weld.resources.ManagerObjectFactory</Arg>

                      <Arg/>

                  </New>

              </Arg>

          </New>

        <New id="ErraiService" class="org.eclipse.jetty.plus.jndi.Resource">

              <Arg> <Ref id="webAppCtx"/> </Arg>

              <Arg>ErraiService</Arg>

              <Arg>

                  <New class="javax.naming.Reference">

                      <Arg>org.jboss.errai.bus.server.service.ErraiService</Arg>

                      <Arg>org.jboss.errai.cdi.server.gwt.ServiceObjectFactory</Arg>

                      <Arg/>

                  </New>

              </Arg>

          </New>

      </Configure>

      ================================================================

      Implements JACCValveFilter according to .JACCValve in tomcat ,set user to ThreadLocal when a web request coming.

       

      Finally, set -XX:PermSize=256M -XX:MaxPermSize=512m at least when execute in console java -XX:PermSize=256M -XX:MaxPermSize=512m -jar start.jar.This issue toke me many days.

        • 1. Re: Start jbpm6.0 on jetty-distribution-7.6.13.v20130916
          Marshal Lee Newbie

          After move JBPM6 to jetty-7.6.13.v20130916 ,I was tried to start JBPM6 on Karaf-2.2.3,failed.How to say,too much issues,such as the import package of the PAX-WEB is not fit to load the modified jetty.xml, the WELD ,Errai CDI,Bitronix and that i was not able to packaging such hundreds of jars in jbpm/web-info/lib.So I was trying to start JBPM6 by(not on) Karaf-2.2.3.The steps as follow:

          1.Make a perfect jetty.home directory that could run JBPM6 .

          2.Create a jar(here ,named as run.jar) instead of start.jar in jetty.home.Make sure you can start jetty no matter where the run.jar is located.

          3.Create a bundle(named as jetty-bundle.jar which could start by karaf) contains all files in jetty.home and run.jar as resource.

          4.when the bundle doStart(),unpackage the resource to somewhere,better in system.java.io.tmpdir

          5.Create a classloader(Loader A) to load run.jar(of course you know the its location ),and starts the Main-Class or some other way to start jetty.

          6.In former 5 steps,only a jetty started with JBPM6. How to enjoy the OSGI environment ?So I create a bundle (named communication-bundle.jar),This bundle will create an instance When osgi-bundle startup.

          jetty-bundle.jar will import it and get the instance,and send to another communication.jar loaded by Loader A,but osgi-classloader. And then,we know,jetty-start will create a classloader(Loader B) to load jar in jetty.home/lib/*.So

          Trying to set communication-instance to  communication.jar in (Loader B).

          Loader B is the classloader of the webapps. Thus, we could could get osgi service instance by communication instance and register a service but only method invoke allowed.

          Bad: Hard to control the service life cycle in SOGI framwork.

           

           

          communication.jar

              ------Config.class

          some final function name,because communication instance is as a Object type and invoked by ServiceManager accorrd function name.

              ------ServiceManager

          private static ServiceManager _superInstance;//will be setted by parent class,who create the classloader.So in common,_superInstance is not null.

          some function to do method.invoke( _superInstance , params)

              ------ServiceManagerCreater.create

          create an communication instance by osgi.activator

              ------Tools

          public static passTo(Classloader cl)

          class=cl.loadClass("package.ServiceManager");

          method=class.getMethod("set",Objec.class);

          //ServiceManager.getSuperInstance() will return instance in current classloader

          //method.invoke(null,ServiceManager.getSuperInstance()) will set the instance to ServiceManager in sub-classloader

          method.invoke(null,ServiceManager.getSuperInstance())

              ------

              ------other class to define how to invoke a service

          Final,we can enjoy osgi environment in JBPM6 ,even not very convenietnt.