Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First EJB Chapter 1 : Advice Application Problem, Please Help

 
Anil Sable
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Friend i am Learning EJB from Head First EJB, Oreilly.

In First Chapter, there is one example about getting random Advice by the AdviceBean class. but i done all the code same as it given in book. but sill i getting the error as :-
--------------------------------
G:\EJB\MyFirstEJBApp\Advice>java -cp %classpath%;AdviceAppClient.jar AdviceClient

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/internal/util/JDKBridge
at com.sun.corba.ee.internal.core.IOR$LocalCodeBaseSingletonHolder.<clinit>(IOR.java:90)
at com.sun.corba.ee.internal.core.IOR.<init>(IOR.java:238)
at com.sun.corba.ee.internal.iiop.messages.LocateReplyMessage_1_2.read(LocateReplyMessage_1_2.java:137)
at com.sun.corba.ee.internal.iiop.IIOPInputStream.unmarshalHeader(IIOPInputStream.java:126)
at com.sun.corba.ee.internal.iiop.IIOPConnection.getResponse(IIOPConnection.java:671)
at com.sun.corba.ee.internal.iiop.IIOPConnection.send(IIOPConnection.java:778)
at com.sun.corba.ee.internal.corba.InitialNamingClient.locateObject(InitialNamingClient.java:786)
at com.sun.corba.ee.internal.corba.InitialNamingClient.getIORUsingHostInfo(InitialNamingClient.java:597)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveCorbaloc(InitialNamingClient.java:573)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveUsingORBInitRef(InitialNamingClient.java:544)
at com.sun.corba.ee.internal.corba.InitialNamingClient.cachedInitialReferences(InitialNamingClient.java:1080)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:981)
at com.sun.corba.ee.internal.corba.ORB.resolve_initial_references(ORB.java:2425)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:52)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:25)
at AdviceClient.main(AdviceClient.java:17)

G:\EJB\MyFirstEJBApp\Advice>
---------------

My Classpath Varible is set as :- "C:\j2sdk1.4.2_19\bin";"C:\j2sdk1.4.2_19\lib";"C:\j2sdkee1.3.1\bin";.;"C:\j2sdkee1.3.1\lib\j2ee.jar";"C:\j2sdkee1.3.1\lib\j2eetools.jar";

JAVA_HOME :- "C:\j2sdk1.4.2_19"
J2EE_HOME :- "C:\j2sdkee1.3.1"

--------------------
Code for the AdviceClient.java is

/*
A Client Class That Make Request for the Bean to The EJB Server through Strub Class.
File Created :-13/Jan/2012 2:22
*/

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

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

public void go()
{
try
{
Context ic = new InitialContext();
Object o = ic.lookup("Advisor");

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

Advice advisor = home.create();
System.out.println("Your Lucky statement is :- " + advisor.getAdvice());
}
catch( Exception ex)
{
System.out.println("----- EXCEPTION -------------");
ex.printStackTrace();
System.out.println("----- EXCEPTION -------------");
}
}
}


Please Help ,
Thank you .
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well champ, class com.sun.corba.se.internal.util.JDKBridge could not be found in your classpath. Make sure one of these files have this class, or include the jar file that has this class.

Now, since we are talking about advices, here's one for you: don't waste your time learning EJB2.x. Thank God almost nobody else uses this nowadays. If you want to learn EJB, I'd recommend Enterprise JavaBeans 3.1, which addresses EJB's latest version.
 
Anil Sable
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Mr. Roberto Perillo. I Solved it, and i think as beginner i should learn basic of ejb 2.0 and then move towards ejb 3.x. Thanks alot.
 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anil Sable wrote:Thank you Mr. Roberto Perillo. I Solved it, and i think as beginner i should learn basic of ejb 2.0 and then move towards ejb 3.x. Thanks alot.

No at all, don't waste your time on EJB2.
 
Shouvanik Haldar
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anil,

You are right. In order to know the basics HF EJB is the best book. Can you please tell me how you solved the problem.

java -cp AdviceAppClient.jar;c:\j2sdkee1.3.1\lib\j2ee.jar;. AdviceClient

After issuing this command, I get the following error

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/internal/util/JDKBridge
at com.sun.corba.ee.internal.core.IOR$LocalCodeBaseSingletonHolder.<clinit>(IOR.java:90)
at com.sun.corba.ee.internal.core.IOR.<init>(IOR.java:238)
at com.sun.corba.ee.internal.iiop.messages.LocateReplyMessage_1_2.read(LocateReplyMessage_1_2.java:137)
at com.sun.corba.ee.internal.iiop.IIOPInputStream.unmarshalHeader(IIOPInputStream.java:126)
at com.sun.corba.ee.internal.iiop.IIOPConnection.getResponse(IIOPConnection.java:671)
at com.sun.corba.ee.internal.iiop.IIOPConnection.send(IIOPConnection.java:778)
at com.sun.corba.ee.internal.corba.InitialNamingClient.locateObject(InitialNamingClient.java:786)
at com.sun.corba.ee.internal.corba.InitialNamingClient.getIORUsingHostInfo(InitialNamingClient.java:597)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveCorbaloc(InitialNamingClient.java:573)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveUsingORBInitRef(InitialNamingClient.java:544)
at com.sun.corba.ee.internal.corba.InitialNamingClient.cachedInitialReferences(InitialNamingClient.java:1080)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:981)
at com.sun.corba.ee.internal.corba.ORB.resolve_initial_references(ORB.java:2425)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.java:52)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:29)
at AdviceClient.main(AdviceClient.java:16)
Caused by: java.lang.ClassNotFoundException: com.sun.corba.se.internal.util.JDKBridge
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 18 more


Please help.

Regards,
Shouvanik
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic