4 Replies Latest reply on Mar 11, 2009 10:06 PM by apdo

    accessing jbpm from multiple web application

      We are upgrading from a old jbpm version to the latest one (3.2).

      We are also modifying the way we will integrate jbpm to our application.

      on the same web server, we plan to have one web site by business process. All these web site will share the same jbpm backend. The reason is that we want to allow users to developpe there own business processes to integrate to our application and we think that it is the more flexible way to do it.

      has proposed in http://jboss.org/index.html?module=bb&op=viewtopic&t=126433.

      I start a standalone jbpm.

      To do this, I create a MBean and bind JbpmConfiguration in JNDI.

      I have create a BPMEngine.sar folder with the following structure

      BPMEngine.sar
      -lib
      |--jboss-el.jar
      |--jbpm-jpdl.jar
      |--jbpmService.jar (include the mbean used to register JbpmConfiguration in a mbean)
      -META-INF
      |--jboss-service.xml (use to genister the mbean)
      |--jboss-app.xml
      -hibernate.cfg.xml
      -jbpm.cfg.xml


      jbpmServie.jar only contains a MBean where the code use to bind the JbpmConfiguration is

      private void rebind() throws NamingException {
      JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();

      InitialContext rootCtx = new InitialContext();
      Name fullName = rootCtx.getNameParser("").parse(jndiName);
      System.out.println("fullName=" + fullName);
      NonSerializableFactory.rebind(fullName, jbpmConfiguration, true);
      }


      1) is JNDI still the way to share jbpm among multiple web application?


      I look into the jmxconsole and I saw an entry in the jndiview for my JbpmConfiguration.


      Then, for my web app (a ear deploy on the same jboss server) that have to use the standalone jbpm I have registered a object that inherit from seam Jbpm. I have overright the startup method to set the jndiname.

      the following class is use to connected to the binded Jbpmconfiguration in JNDI
      @Scope(ScopeType.APPLICATION)
      @BypassInterceptors
      @Startup
      @Name("org.jboss.seam.bpm.jbpm")
      @Install(precedence=FRAMEWORK)
      public class SolabsJbpm extends Jbpm {

      private static final LogProvider log = Logging.getLogProvider(SolabsJbpm.class);
      private JbpmConfiguration jbpmConfiguration;

      @Create @Override
      public void startup() throws Exception
      {
      super.startup();
      setJbpmConfigurationJndiName("jbpm/Jbpmconfiguration");
      Init.instance().setJbpmInstalled(true);
      }
      }

      however I got the following exception:

      Caused by: java.lang.ClassCastException: org.jbpm.JbpmConfiguration cannot be cast to org.jbpm.JbpmConfiguration
      at org.jboss.seam.bpm.Jbpm.initJbpmConfiguration(Jbpm.java:108)
      at org.jboss.seam.bpm.Jbpm.getJbpmConfiguration(Jbpm.java:93)
      at org.jboss.seam.example.todo.SolabsProcessDefinitionBean.findProcessDefinitionListToStart(SolabsProcessDefinitionBean.java:46)
      ... 134 more


      2) Do somebody know how to make the lookup in jndi work for JbpmConfiguration?


      to test If my method to bind object in jndi work, I try to bind a String object and I was able to get it using a lookup. however it doestn't work with JbpmConfiguration.

      I have also tested adding a call to PortableRemoteObject.narrow and I was still getting an exception:
      Caused by: java.lang.ClassCastException
      at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:229)
      at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
      at org.jboss.seam.example.todo.SolabsJbpm.initJbpmConfiguration(SolabsJbpm.java:72)
      at org.jboss.seam.example.todo.SolabsJbpm.getJbpmConfiguration(SolabsJbpm.java:54)
      at org.jboss.seam.example.todo.SolabsProcessDefinitionBean.findProcessDefinitionListToStart(SolabsProcessDefinitionBean.java:46)
      ... 130 more
      Caused by: java.lang.ClassCastException: Class org.jbpm.JbpmConfiguration is not a valid remote interface
      at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:225)
      ... 134 more



      An Phong Do
      solabs.com