• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

On running a stand alone client there is no output

Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am using j2sdk1.4 and j2sdkee RI 1.3. I have tried to develop the EJB code which is provided in Head First EJB in the first chapter. Everything happened accordingly till deployment. When I tried to run the client I received an exception.

For your reference I am posting the classes and the output below:

This is the Remote Interface:

package headfirst;

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

public interface Advice extends EJBObject
public String getAdvice()throws RemoteException;

This is the session bean:

package headfirst;

import javax.ejb.*;
public class AdviceBean implements SessionBean
private String[] adviceStrings = {"One word: inappropriate",
"You might want to rethink that haircut",
"You boss will respect you if you tell him what you really think of him",
"Visualize yourself with better clothes",
"Of course you dont have to go to work today",
"Do you really think you should be leaving the house like that",
"Read a book once a year, whether you need it or not."};

public void ejbActivate(){

public void ejbPassivate(){

public void ejbRemove(){
System.out.println("ejb remove");

public void setSessionContext(SessionContext ctx){
System.out.println("session context");

public String getAdvice(){
System.out.println("In get advice");
int random = (int)(Math.random() * adviceStrings.length);
System.out.println("In getAdvice method.....in the AdviceBean ");
return adviceStrings[random];

public void ejbCreate(){
System.out.println("ejb create");


This is the home interface:

package headfirst;

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

public interface AdviceHome extends EJBHome
public Advice create()throws CreateException, RemoteException;

and this is the client code:

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

public class AdviceClient
public static void main(String[] args)
new AdviceClient().go();

public void go(){
Context ic = new InitialContext();

Object o = ic.lookup("Advisor");

System.out.println("object is " + o);

AdviceHome home = (AdviceHome)PortableRemoteObject.narrow(o, AdviceHome.class);

Advice advisor = home.create();

}catch(Exception e){

This is the output which I receive when run the client:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/inte
at com.sun.corba.ee.internal.core.IOR$LocalCodeBaseSingletonHolder.<clin
at com.sun.corba.ee.internal.core.IOR.<init>(IOR.java:238)
at com.sun.corba.ee.internal.iiop.messages.LocateReplyMessage_1_2.read(L
at com.sun.corba.ee.internal.iiop.IIOPInputStream.unmarshalHeader(IIOPIn
at com.sun.corba.ee.internal.iiop.IIOPConnection.getResponse(IIOPConnect
at com.sun.corba.ee.internal.iiop.IIOPConnection.send(IIOPConnection.jav
at com.sun.corba.ee.internal.corba.InitialNamingClient.locateObject(Init
at com.sun.corba.ee.internal.corba.InitialNamingClient.getIORUsingHostIn
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveCorbaloc(I
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveUsingORBIn
at com.sun.corba.ee.internal.corba.InitialNamingClient.cachedInitialRefe
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolve_initial_r
at com.sun.corba.ee.internal.corba.ORB.resolve_initial_references(ORB.ja
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:19)
at AdviceClient.main(AdviceClient.java:11)

I have mentioned Advisor as the JNDI name for the Bean "AdviceBean" in the RI tool.

Please help me as how to fix this error:
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic