0 Replies Latest reply on Feb 8, 2006 3:23 PM by andy malycky

    Retrieving JBPMSessionFactory from JNDI (& Hibernate Session

    andy malycky Newbie

      I am trying to run jBPM on Weblogic

      I wanted to bind the JBPMSessionFactory into the JNDI (with a startup servlet) in order to have the factory up and running upon any call to getInstance

      I set the jndi property in jbpm.properties and If I am "locally" calling JbpmSessonFactory.getInstance() it does a jndi lookup, I can retrieve the factory, open a session and go from there

      But, if I try to do this "remotely", in other words calling an EJB method from a client, when i try to retrieve the JbpmSessionFactory from the jndi in the EJB business method i get a RemoteException (wrapping "Could not find a SessionFactory named: null") that appears to fall down when trying to serialize and then de-serialize a hibernate SessionFactory (presumably one associated with the JbpmSessionfactory)

      Hibernate docs state you must bind a Sessionfactory into the JNDI if you will be serializing/de-serializing it (as will happen per an EJB call) so I tried to set the Hibernate property to allow for doing this on startup just after I bind the jbpmSessionFactory.

      Unfortunately when I execute jbpmSessionFactory.getConfiguration().configure().buildSessionFactory() in order to trigger the auto hibernate bind into the JNDi, i get errors relating to duplicate mapping collections (because it was all mapped when i created the jBPMSession first, I assume). So I just grab the SessionFactory from the JBPMSessionFActory and bind it myself.

      NOW, when my EJB method tries to grab the JBPMSessionFactory from the jndi, it craps out because internally it cannot resolve the lookup using the hibernate session factory jndi property (although the SessionFactory IS bound into the JNDI with this name...) note that I never reference the the hib Sessionfactory myself, I assume the JBPMSessionfactory is making the call to Hib to get a SessionFactory and since it is configed to grab from the jndi, it tries, but ultimately fails...

      Anybody???