2 Replies Latest reply on Oct 27, 2005 2:04 PM by alal lal

    how to get jndisessionfactory using jndiname in websphere

    alal lal Newbie

      If someone has successfully deployed jbpm on websphere and calling from stateless session bean, please help me.
      PLEASE let me know what exactly I am doing wrong here
      I am sure I am missing setup in
      how to associate jbpmSessionFactory with jndiname.

      My jbpm property file
      
      jbpm.scheduler.service.factory=org.jbpm.scheduler.impl.SchedulerServiceImpl
      jbpm.task.instance.class=org.jbpm.taskmgmt.exe.TaskInstance
      jbpm.session.factory.jndi.name=java:/jbpm/JbpmSessionFactory
      jbpm.hibernate.properties=hibernate.properties
      


      My Hybernate Properties file
      hibernate.dialect=org.hibernate.dialect.Oracle9Dialect
      hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
      hibernate.connection.url=jdbc:oracle:thin:@<my_ip_ddress:port:db_sid>
      hibernate.connection.username=<db_user_name>
      hibernate.connection.password=<db_user_password>
      hibernate.jndi.class=com.ibm.websphere.naming.WsnInitialContextFactory
      hibernate.jndi.url=iiop://localhost:2809/
      hibernate.connection.datasource=<DMydataSource>
      hibernate.transaction.flush_before_completion=true
      hibernate.transaction.release_mode=after_statement
      hibernate.transaction.auto_close_session=true
      hibernate.show_sql=true
      hibernate.query.substitutions=true 1, false 0
      

      my hibernate.cfg.xml
      <hibernate-configuration>
       <session-factory>
       <property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
       <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
       <property name="hibernate.connection.url">jdbc:oracle:thin:@my_ip_address:port:db_sid</property>
       <property name="hibernate.connection.username">xxxxxx</property>
       <property name="hibernate.connection.password">yyyyyy</property>
      

      public java.lang.Long createNewProcessInstance(String processName)
       {
       java.lang.Long processId = new Long(0);
       JbpmSessionFactory jbpmSessionFactory = null;
       JbpmSession jbpmSession = null;
      
       if (processName != null && processName.trim().length() > 0)
       {
       try {
      
       Hashtable env = new Hashtable();
       env.put(Context.INITIAL_CONTEXT_FACTORY,
       "com.ibm.websphere.naming.WsnInitialContextFactory");
       env.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2809");
       Context iniCtx = new InitialContext(env);
      
       /*javax.naming.InitialContext iniCtx =
       new javax.naming.InitialContext();*/
       /*jbpmSessionFactory =
       (JbpmSessionFactory) iniCtx.lookup("java:/jbpm/JbpmSessionFactory"); */
      
       /*jbpmSessionFactory =
       (JbpmSessionFactory) iniCtx.lookup("ejb/MyPssTestFacade");*/
      
       jbpmSessionFactory = (JbpmSessionFactory) iniCtx.lookup("jbpm/JbpmSessionFactory");
      
       }
       catch (Exception e)
       {
       LOG.error("coulnd't buildJbpmSessionFactory", e);
       return new Long(0);
       }
      
       /* code here opening session etc*/
       }
      


      I am getting error in getting jbpmsession factory

      5:07:25,094 DEBUG MyPssTestFacadeBean : creating processInstnace
      05:07:25,594 DEBUG MyPssTestFacadeBean : about to get JbpmSessionFactory
      05:07:49,438 ERROR MyPssTestFacadeBean : coulnd't buildJbpmSessionFactory
      javax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server1, name: jbpm/JbpmSessionFactory: First component in name jbpm/JbpmSessionFactory not found. Root exception is
      org.omg.CosNaming.NamingContextPackage.NotFound:
      IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
      at java.lang.Throwable.<init>(Throwable.java)
      at java.lang.Throwable.<init>(Throwable.java)
      at org.omg.CosNaming.NamingContextPackage.NotFound.<init>(NotFound.java:35)


      and if I use
      iniCtx.lookup("java:/jbpm/JbpmSessionFactory"); then I get error

      05:00:15,820 ERROR MyPssTestFacadeBean : coulnd't buildJbpmSessionFactory
      javax.naming.NameNotFoundException: Name not found in context "java:".
      at java.lang.Throwable.<init>(Throwable.java)
      at java.lang.Throwable.<init>(Throwable.java)
      at javax.naming.NamingException.<init>(NamingException.java:111)



      PLEASE PROVIDE ME SOME POINTERS. IN ABSENCE OF ANY DOCUMENT ABOUT HOW TO USE JBPM ON WEBSPHERE I AM KIND OF STUCK.