2 Replies Latest reply on Mar 5, 2008 9:36 PM by aguizar

    Problem in Running JBPEL Client Component

    yogesharora

      Hi,

      I am trying to write a standalone Java client for the HelloWorld Sample that comes with JBPEL from <<jbpm-bpel-1.1.GA>>\examples\hello and getting the the following Error:

      javax.naming.NameNotFoundException: jbpmbpel-client not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
      at sun.reflect.GeneratedMethodAccessor184.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
      at sun.rmi.transport.Transport$1.run(Transport.java:153)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:149)


      Environment Details
      ===============
      JBPM - Version 3.1.4
      jbpm-bpel - Version 1.1.GA.
      JBoss - Version 4.2.2.GA
      Eclipse - 3.3
      JDK - version 1.5

      MyClient.java
      =========

      package org.jbpm.bpel.tutorial.hello;

      import java.io.IOException;
      import java.util.Hashtable;

      import javax.naming.InitialContext;
      import javax.xml.rpc.ServiceException;

      import org.tempuri.hello.Greeter;
      import org.tempuri.hello.HelloWorldService;

      public class MyClient {
      private HelloWorldService helloService;

      public static final String JNDI_NAME = "java:comp/env/service/Hello";

      /**
      * To handle the get requests.
      *
      * @param HttpServletRequest -
      * theRequest
      * @param HttpServletResponse -
      * theResponse
      * @throws IOException
      */
      public static void main(String[] args){

      MyClient client = new MyClient();
      client.test();
      }

      public void test(){

      helloService = (HelloWorldService) doJNDILookup(JNDI_NAME);
      if(helloService == null){
      System.out.println("Service not found. Exiting.....");
      return;
      }
      try {

      Greeter greeter = helloService.getGreeterPort();
      String greeting = greeter.sayHello("Yogesh");
      System.out.println("<<<<< greeting >>>> " + greeting);
      } catch (ServiceException se) {
      System.out.println("ServiceException Thrown >>>" + se.getMessage());
      se.printStackTrace();
      }
      catch(Exception e){
      System.out.println("Exception Thrown >>>" + e.getMessage());
      e.printStackTrace();

      }
      }

      /**
      *
      * @param jndiName
      * @return the Object
      */
      public static Object doJNDILookup(String jndiName) {
      Object object = null;
      try {

      Hashtable env = new Hashtable();
      env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
      env.put("java.naming.provider.url", "jnp://localhost:1099");
      env.put("java.naming.factory.url.pkgs", "org.jboss.naming.client");
      env.put("j2ee.clientName","jbpmbpel-client");

      InitialContext ctx = new InitialContext(env);

      System.out.println(ctx.getEnvironment());

      object = ctx.lookup(jndiName);
      } catch (Exception e) {
      e.printStackTrace();
      }
      return object;
      }
      }