2 Replies Latest reply on Feb 10, 2002 7:17 PM by ipozeng

    Why cannot i lookup the session bean?

    ipozeng

      I am sure the session bean has been deployed successfully by using JNDIView:
      ...
      Global JNDI Namespace
      ...
      +- invokers (class: org.jnp.interfaces.NamingContext)
      | +- ejb (class: org.jnp.interfaces.NamingContext)
      | | +- Coffees (class: org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker)
      +- ejb (class: org.jnp.interfaces.NamingContext)
      | +- Coffees (proxy: $Proxy2 implements com.zsoft.coffee.interfaces.CoffeesHome)
      ...
      However it always reports "javax.naming.CommunicationException. Root exception is java.lang.ClassNotFoundException: org.jboss.ejb.plugins.jrmp13.interfaces.HomeProxy
      at java.net.URLClassLoader$1.run(URLClassLoader.java:200)" when executing lookup.
      The code snippet is as below:
      ...
      Properties h = new Properties();
      h.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
      h.put(Context.PROVIDER_URL,"192.168.1.133:1099");
      InitialContext ctx = new InitialContext(h);
      System.out.println("got context");

      CoffeesHome home =
      (CoffeesHome) ctx.lookup("ejb/Coffees"); <===raise error here
      System.out.println("lookup......");

      Coffees sessionBean = home.create();
      System.out.println("got remote interface");
      ...
      Maybe i lose some jar files but what is that? i have added all jar in $(jboss.home)/client directory to the classpath.

      Any suggestion is appreciated!

        • 1. Re: Why cannot i lookup the session bean?

          This class should be in jboss-client.jar

          Perhaps you can explain your classpath/classloader config?
          Which version are you using?

          Regards,
          Adrian

          • 2. Re: Why cannot i lookup the session bean?
            ipozeng

            Thanks for your reply.I used a shell script as below to run the test client:
            #!/bin/sh

            CP=/usr/local/jboss/client/junit.jar:$CLASSPATH

            CP=/usr/local/jboss/client/jnp-client.jar:$CP
            CP=/usr/local/jboss/lib/ext/jboss-j2ee.jar:$CP
            CP=/usr/local/jboss/lib/jmxri.jar:$CP

            java -Djava.security.policy=client.policy -Djava.security.manager -classpath ../build/classes:$CP junit.textui.TestRunner com.zsoft.coffee.test.CoffeesClient
            So the jboss-client is not in the classpath. When adding it,it works now :)

            Thank you very much!