Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help run to first programme

niroshan iranga
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello i m new to the ejb
i tried to run the very simple exaple i was able to compile the following code and deploy them to the j2ee server but i wavs un able to run the cilent program in the same machine

here are the codes

// this is remote intterface class

public interface remote extends javax.ejb.EJBObject{
public String show() throws java.rmi.RemoteException;


//home interface

import javax.ejb.*;
import java.rmi.*;
public interface homeinter extends EJBHome{
remote create()throws CreateException,RemoteException;



import javax.ejb.SessionBean;
import javax.ejb.EJBException;
import java.rmi.RemoteException;
import javax.ejb.SessionContext;
public class bean implements SessionBean {

SessionContext sct;
public String show() throws RemoteException {
return " this is from bean";

public void ejbActivate(){}
public void ejbPassivate(){}
public void ejbCreate(){}
public void ejbRemove(){}

public void setSessionContext(SessionContext set){



// client

import javax.ejb.*;
import javax.rmi.*;
import javax.naming.*;
import java.rmi.*;

public class client {
public static void main(String[] args) {
InitialContext ic= new InitialContext();
Object obj= ic.lookup("MySecond");
homeinter h=(homeinter)PortableRemoteObject.narrow(obj,homeinter.class);
remote r=h.create();
System.out.println("the return value is" +;
}catch(Exception e){



in the DOS prompt i tried to run the programme like

set CPATH=.;c:\j2ee\lib\j2ee.jar;secondClient.jar
java -Dorg.omg.CORBA.ORBInitialHost=lacalhost -classpath %CPATH% client

then i had the following error mesage

C:\ejb>set CPATH=.;c:\j2ee\lib\j2ee.jar;secondClient.jar

C:\ejb>java -Dorg.omg.CORBA.ORBInitialHost=Localhost -classpath .;c:\j2ee\lib\
j2ee.jar;secondClient.jar client
Exception in thread "main" java.lang.NoSuchMethodError: loadClass0

at javax.rmi.CORBA.Util.loadClass(Unknown Source)
at javax.rmi.PortableRemoteObject.createDelegateIfSpecified(Unknown Sour
at javax.rmi.PortableRemoteObject.<clinit>(Unknown Source)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
at com.sun.enterprise.naming.SerialContext.<init>(

at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at client.main(

pls give me a solution
thank you
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic