1 Reply Latest reply on Jul 11, 2006 4:53 AM by Koen Aers

    hibernate.cfg.xml not found (pb with rmi)

    Aymen mneja Newbie

      I have created a server rmi that implement function that call JBPM to create an instance of a process stored in a Database.

      I ran a server rmi, but when I call the function which call jbpm from a client
      I get this pb:


      org.hibernate.HibernateException: hibernate.cfg.xml not found
      at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:147)
      at org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:1236)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:1258)
      at org.jbpm.db.hibernate.HibernateHelper.createConfiguration(HibernateHelper.java:90)
      at org.jbpm.persistence.db.DbPersistenceServiceFactory.getConfiguration(DbPersistenceServiceFactory.java:68)
      at org.jbpm.persistence.db.DbPersistenceServiceFactory.getSessionFactory(DbPersistenceServiceFactory.java:90)
      at org.jbpm.persistence.db.DbPersistenceService.getSessionFactory(DbPersistenceService.java:74)
      at org.jbpm.persistence.db.DbPersistenceService.getSession(DbPersistenceService.java:78)
      at org.jbpm.persistence.db.DbPersistenceService.getGraphSession(DbPersistenceService.java:216)
      at org.jbpm.JbpmContext.getGraphSession(JbpmContext.java:433)
      at com.orange_ft.rd.jbpm.rmi.MyServer.CreateProcessInstance(MyServer.java:43)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at com.orange_ft.rd.jbpm.rmi.MyServer_Stub.CreateProcessInstance(Unknown Source)
      at com.orange_ft.rd.jbpm.rmi.Client.CreateInstance(Client.java:28)
      at com.orange_ft.rd.jbpm.rmi.Client.main(Client.java:88)


      the code of my server is

      public class MyServer extends UnicastRemoteObject implements ManageProcessServiceIntf{

      /**
      *
      */
      private static final long serialVersionUID = 1L;

      static JbpmConfiguration jbpmConfiguration=JbpmConfiguration.getInstance();


      protected MyServer() throws RemoteException {
      super();

      }
      public void CreateProcessInstance(String NomProcess) throws RemoteException {
      jbpmConfiguration1=JbpmConfiguration.getInstance();

      JbpmContext jbpmContext1 = jbpmConfiguration.createJbpmContext();

      try {

      GraphSession graphSession = jbpmContext1.getGraphSession();

      ProcessDefinition processDefinition1 =
      graphSession.findLatestProcessDefinition(NomProcess);

      ProcessInstance processInstance =new ProcessInstance(processDefinition1);
      Token token = processInstance.getRootToken();
      token.signal();
      jbpmContext1.save(processInstance);
      System.out.println(">>>>Le processus est maintenant dans la phase: "+ token.getNode().getName());

      while ((token.hasEnded()==false))
      {
      System.out.println(">>>>Le processus est dans l'attente d'une validation au niveau de la phase "+token.getNode().getName()+" , que voulez vous faire: ");
      System.out.println(">> Tapez 'c' pour continuer l'execution du processus et passer à l'étape suivante");
      System.out.println(">> Tapez 's' pour sauvegarder l'instance dans la persistance");
      char s=readChar();
      if (s=='c')
      {token.signal();
      jbpmContext1.save(processInstance);

      }
      else
      {
      System.out.println(">>>> Instance sauvegardée ");
      break;
      }

      }
      if (token.hasEnded())
      System.out.println(">>>>Le processus a terminé son execution");


      } finally {
      // Tear down the pojo persistence context.
      jbpmContext1.close();

      }
      System.out.println(">>> FIN");
      }

      public static void main(String[] args) {


      if (System.getSecurityManager() == null) {
      System.setSecurityManager(new RMISecurityManager());
      }

      try {
      MyServer srv;
      String bindingName;

      srv = new MyServer();
      bindingName = "//" + HOST_NAME + ":"
      + PORT_NAME + "/"
      + SERVICE_NAME;
      Naming.rebind(bindingName, srv);
      System.out.println("Service bound");
      } catch (Exception e) {
      System.err.println("Exception in service: " + e.getMessage());
      e.printStackTrace();
      }
      }


      the interface of this server is

      public interface ManageProcessServiceIntf extends Remote , Serializable {
      public static final String SERVICE_NAME = "JBPMService";
      public static final String HOST_NAME = "127.0.0.1";
      public static final String PORT_NAME = "1099";
      public void CreateProcessInstance(String NomProcess) throws RemoteException;


      note that this function have worked locally (without the rmi server)
      please help me