Connecting to EJB


EJB programming & troubleshooting: Connecting to EJB

  1. Connecting to EJB (2 messages)


    I have an ejb deployed successfully. This is my client code:
    package examples;

    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.Properties;

    public class HelloClient {
    public static void main(String[] args) throws Exception {
    Properties props = System.getProperties();
    Context ctx = new InitialContext(props);
    Object obj = ctx.lookup("HelloHome");
    HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
    Hello hello = home.create();

    When I compile it & run it, I get an error: class not found (wrong name:examples/HelloClient). Can you please help? I have the ap server running. I'm using weblogic 8.1.


    Threaded Messages (2)

  2. Connecting to EJB[ Go to top ]

    Hope You are running like
    java examples.HelloClient (If running from console, run before the xamples dir. location.)
    Also the classpath must have an entry just before examples package.
  3. Connecting to EJB[ Go to top ]

    Common...again classpath problem.

    Okay! do the following steps:
    1) Open cmd prompt
    2) run setenv.bat
    3) say
       set classpath=%classpath%;c:/yourBuildDirectory;

    and now run your client.