2 Replies Latest reply on Sep 30, 2003 3:50 AM by wdmsyf

    EJBClient error, help

    wdmsyf Newbie

      I have a Session bean deployed to JBoss3.2.1. When I tried to run my client program from the same PC, I got the following message:
      java.lang.ClassCastException: org.jnp.interfaces.MarshalledValuePair
      at test.Client.getHome(Client.java:30)
      at test.Client.testBean(Client.java:55)
      at test.Client.main(Client.java:82)
      Exception in thread "main"
      My code:
      package test;

      import java.rmi.RemoteException;
      import java.util.Hashtable;

      import javax.ejb.CreateException;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;

      import au.com.ausc.MySessionHome;
      import javax.rmi.*;

      /**
      * @author Youfu Sheng
      *
      * 2003-9-25
      */
      public class Client
      {

      private au.com.ausc.MySessionHome getHome() throws NamingException
      {
      InitialContext ctx = getContext();
      MySessionHome mySess = (MySessionHome) ctx.lookup(MySessionHome.JNDI_NAME);

      return mySess;
      }
      private InitialContext getContext() throws NamingException
      {
      Hashtable props = new Hashtable();

      props.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      props.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");

      // This establishes the security for authorization/authentication
      // props.put(InitialContext.SECURITY_PRINCIPAL,"username");
      // props.put(InitialContext.SECURITY_CREDENTIALS,"password");

      InitialContext initialContext = new InitialContext(props);
      System.out.println("Here");
      return initialContext;
      }
      public void testBean()
      {
      try
      {
      au.com.ausc.MySession myBean = getHome().create();

      //--------------------------------------
      //This is the place you make your calls.
      //System.out.println(myBean.callYourMethod());
      String request = "I'm tired of 'Hello, world' examples..";
      System.out.println("Request from client : " + request);
      System.out.println("Message from server : " + myBean.learnJ2EE(request) );

      }
      catch (RemoteException e)
      {
      e.printStackTrace();
      }
      catch (CreateException e)
      {
      e.printStackTrace();
      }
      catch (NamingException e)
      {
      e.printStackTrace();
      }
      }

      public static void main(String[] args)
      {
      Client test = new Client();
      test.testBean();

      }
      }




      Who can help me ??