aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Head First EJB Chapter 1 : Advice Application Problem, Please Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Head First EJB Chapter 1 : Advice Application Problem, Please Help" Watch "Head First EJB Chapter 1 : Advice Application Problem, Please Help" New topic
Author

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

Anil Sable
Greenhorn

Joined: Jan 08, 2012
Posts: 10
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

Joined: Dec 28, 2007
Posts: 2266
    
    3

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.


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Anil Sable
Greenhorn

Joined: Jan 08, 2012
Posts: 10
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

Joined: Nov 08, 2003
Posts: 3479

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

Joined: Jun 16, 2010
Posts: 19
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


Shouvanik Haldar
SCJP 1.5
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Head First EJB Chapter 1 : Advice Application Problem, Please Help