users@glassfish.java.net

java.lang.ClassNotFoundException while ejb3 lookup

From: <glassfish_at_javadesktop.org>
Date: Mon, 02 Jun 2008 05:22:16 PDT

Hi,

I'm trying to lookup an EJB3 stateless bean from another EJB3 stateless bean in a different project under same GlassFish Container. But while lookup, i'm getting "[b][u]Root exception is java.lang.ClassNotFoundException[/u][/b]". Where should i put the jar for the EJB3 bean which is looking up?

My client EJB3 bean code is as follows:

package ejb3;

import java.util.Properties;

import javax.ejb.Stateless;
import javax.naming.InitialContext;

import ejb3.Ejb3ServerRemote;

@Stateless(name="Ejb3Client", mappedName="Ejb3Client")
public class Ejb3Client implements Ejb3ClientRemote {
        public void callRemoteMethod(String msg) {
                System.out.println("Inside callRemoteMethod...");
                Ejb3ServerRemote server = null;
                try
                {
                        Properties props = new Properties();
                        props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
                        props.setProperty("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
                        props.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
                        props.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
                        props.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
                        InitialContext ctx = new InitialContext(props);
                        server = (Ejb3ServerRemote)ctx.lookup("Ejb3Server");
                        server.callMe(msg);
                }
                catch(Exception e){
                        e.printStackTrace();
                }
        }

}


Thanks in Advance,
Mathew Pappady
[Message sent by forum member 'mathewpappady' (mathewpappady)]

http://forums.java.net/jive/thread.jspa?messageID=277823