wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Almost have AdviceClient run, but.... help! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Almost have AdviceClient run, but.... help!" Watch "Almost have AdviceClient run, but.... help!" New topic
Author

Almost have AdviceClient run, but.... help!

Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
Spent whole day to get this far. But for the last step to run AdviceClient, I got the following error:

===============================================
F:\Certification\SCBCD\projects\advice>java -cp %CLASSPATH%;AdviceAppClient.jar
AdviceClient


Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/corba/se/inte
rnal/util/JDKBridge
at com.sun.corba.ee.internal.core.IOR$LocalCodeBaseSingletonHolder.<clin
it>(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(L
ocateReplyMessage_1_2.java:137)
at com.sun.corba.ee.internal.iiop.IIOPInputStream.unmarshalHeader(IIOPIn
putStream.java:126)
at com.sun.corba.ee.internal.iiop.IIOPConnection.getResponse(IIOPConnect
ion.java:671)
at com.sun.corba.ee.internal.iiop.IIOPConnection.send(IIOPConnection.jav
a:778)
at com.sun.corba.ee.internal.corba.InitialNamingClient.locateObject(Init
ialNamingClient.java:786)
at com.sun.corba.ee.internal.corba.InitialNamingClient.getIORUsingHostIn
fo(InitialNamingClient.java:597)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveCorbaloc(I
nitialNamingClient.java:573)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolveUsingORBIn
itRef(InitialNamingClient.java:544)
at com.sun.corba.ee.internal.corba.InitialNamingClient.cachedInitialRefe
rences(InitialNamingClient.java:1080)
at com.sun.corba.ee.internal.corba.InitialNamingClient.resolve_initial_r
eferences(InitialNamingClient.java:981)
at com.sun.corba.ee.internal.corba.ORB.resolve_initial_references(ORB.ja
va:2425)
at com.sun.enterprise.naming.SerialContext.getProvider(SerialContext.jav
a:52)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:120
)
at javax.naming.InitialContext.lookup(Unknown Source)
at AdviceClient.go(AdviceClient.java:16)
at AdviceClient.main(AdviceClient.java:10)
====================================================


Please help
amol deshpande
Ranch Hand

Joined: Sep 05, 2003
Posts: 162
Hi Richard,
that %classpath% stuff in java command doesnt work in windows.
run this command
java -cp XXXX;f:\yourdir\AdviceAppClient.jar HelloClient

* replace XXXX by typing your classpath there.
you can see classpath by echo %classpath%

that will work.

Follow above steps and it should work.
Amol.
Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
Thanks, amol,

I do think %CLASSPATH% works with Windows because I used it to compile AdviceClient.java in the first place. I do not know why it complains that
"javax.naming.InitialContext.lookup(Unknown Source)" because I am pretty sure that I entered "Advisor" as JNDI name why it can't find it???

Anyway, when you say "replace XXXX by typing your classpath", do you mean j2ee.jar or complete classpath? Can you give me your example?

Thanks
Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
Just tried amol's suggestion and got exactly the same error. I think it is JNDI problem but I do not know how to fix it. Anyone, please shed lignt on this.
Lahiru Abeydeera
Ranch Hand

Joined: Nov 05, 2004
Posts: 44
the error (As I guess)is you have to specify your servers properties (such as INITIAL_CONTEXT_FACTORY etc.. etc.. ) . But the sad story is I cant remember how to do it. If you can wait till monday i may be able to help you.

I had the same problem and, it worked after adding those lines it worked. If you have set properties and still it doesnt's work add the "appserver-rt.jar" file to your class path and run


GOOD LUCK
I'm wondering why kathey And Bert made such a big mistake in such a very goooood book.
[ February 26, 2005: Message edited by: Lahiru Abeydeera ]
Richard Vagner
Ranch Hand

Joined: Jun 26, 2001
Posts: 107
Lahiru,

Thanks for your help.
How do you define the server properties?
Roger Cavallo
Greenhorn

Joined: Mar 02, 2005
Posts: 3
Use this in the client code

Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
env.put(Context.PROVIDER_URL, "iiop://localhost:3700");
Context context = new InitialContext(env);
Object o = context.lookup ("AdviceBean");

And u may have to download jndi.jar and have it in your CLASSPATH or lib/ext directory
amol deshpande
Ranch Hand

Joined: Sep 05, 2003
Posts: 162
Hi friends,

this is my existing classpath
d:\j2sdkee1.3\lib\j2ee.jar;d:\ejbpro;d:\j2sdk1.3\jre\lib\rt.jar;

Now , my advice app stuff is here
d:\ejbpro\advice
amol deshpande
Ranch Hand

Joined: Sep 05, 2003
Posts: 162
Hi friends,

this is my existing classpath
d:\j2sdkee1.3\lib\j2ee.jar;d:\ejbpro;d:\j2sdk1.3\jre\lib\rt.jar;

Now , my advice app stuff is here
d:\ejbpro\advice ...here i have home,component and bean.

now our client goes here
d:\ejbpro

to compile client , follow this
d:\ejbpro\javac -classpath d:\j2sdkee1.3\lib\j2ee.jar;d:\j2sdk1.3\jre\lib\rt.jar;d:\ejbpro;d:\ejbpro\AdviceAppClient.jar AdviceClient.java

Note: no need for that rt.jar there, im using just for consistancy.

now your app is deployed, client is compiled and your just ready to java on it.

run by this
java -cp d:\ejbpro;d:\j2sdkee1.3\lib\j2ee.jar;d:\j2sdk1.3\jre\lib\rt.jar;d:\ejbpro\AdviceAppClient.jar AdviceClient


You are getting InitialContext exception because java needs one to use jndi..its jndi stuff error...to avoid it , please make sure you use j2ee.jar in your classpath while running client.

I have w2k professional , j2ee v1.3, jdk 1.3 and this %classpath% stuff doesnt work in my pc.
I hope this stuff solves probs....get to me if you get any more or same errors.
Amol.
Sun Raj
Greenhorn

Joined: Mar 09, 2005
Posts: 11
I was struggling with this problem all day yesterday. Today I fixed it.
I found the following link that helped me:
http://www.wickedlysmart.com/HeadFirst/HeadFirstEJB/HeadFirstEJBNotes.html

-SR
Jason Mowat
Ranch Hand

Joined: Aug 17, 2003
Posts: 79
Hi Richard,

Take out the CLASSPATH from your environment. It can screw things up too much; instead, specify the classpath directly from the command line. Make sure you set up your Java environment variables, though:

JAVA_HOME = x:\java1.4 (whatever yours is)
J2EE_HOME = x:\j2ee1.3 (whatever yours is)
PATH=(lots of other stuff);%JAVA_HOME%\bin;%J2EE_HOME%\bin

Secondly, ensure that %J2EE_HOME%/lib/j2ee.jar is on your classpath, as your client has dependencies that are in it.

F:\Certification\SCBCD\projects\advice>java -cp %J2EE_HOME%/lib/j2ee.jar%;AdviceAppClient.jar
AdviceClient

It should run just fine.

Cheers,
Jason
Sun Raj
Greenhorn

Joined: Mar 09, 2005
Posts: 11
Add . to your classpath too.
SR
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Almost have AdviceClient run, but.... help!
 
Similar Threads
Error in compiling Advice Client in ejb
Another prob w/ AdviceClient app - JDKBridge??
HFEJB chapt1 demo (AdviceClient)
Why do i get this Exception?
HFEJB AdviceClient fail