0 Replies Latest reply: Feb 1, 2011 10:56 AM by 747465 RSS

    Test BRM adapter through Java

    747465
      Hi,

      I am trying to find out if we can test BRM adapter from Java.
      I am trying to write a java code to connect to a BRM jca adapter and send input messages to its opcodes.
      The BRM adapter is deployed on a soa server which is not on my machine.
      Following is the code where i am just trying to lookup the jndi.

      import java.util.Hashtable;

      import javax.naming.Context;
      import javax.naming.InitialContext;

      import javax.naming.NamingException;

      import javax.resource.ResourceException;
      import javax.resource.cci.Connection;
      import javax.resource.cci.ConnectionFactory;
      import javax.resource.cci.Interaction;

      ConnectionFactory connectionFactory = null;
      Hashtable props = new Hashtable();
      props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "jnp://lcl2110:11960"); // lcl2110 11960 is present in the connection string in the adapter section of em console.
      InitialContext ctx= new InitialContext(props);
      connectionFactory = (ConnectionFactory)ctx.lookup("java:comp/env/eis/BRM");
      Connection connection = connectionFactory.getConnection();
      Interaction interaction = connection.createInteraction();

      I have caught all the required exceptions.

      I have added "connector-api-1.5.jar" in my classpath.

      I am getting the following error:

      javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

      Kindly let me know if I have missed something.

      Thanks in advance!!!!!!!!