This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Problem witth NoInitialContextException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Problem witth NoInitialContextException" Watch "Problem witth NoInitialContextException" New topic
Author

Problem witth NoInitialContextException

Micheal John
Ranch Hand

Joined: Nov 01, 2006
Posts: 344
I am started learning EJB from HFEJB for the exam: I have a tought time with the first sample example on sesion bean:

Why I am getting this error? How to resolve it?



My Folder structure:










Micheal John
SCJP 1.4 (86%), SCWCD 1.4 (86%), SCBCD 1.3 (85%), SCDJWS (Just Started...) - Satisfaction Lies in Our EFFORT, Not in the ATTAINMENT
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

You need to pass two properties to the InitialContext, viz., Context.INITIAL_CONTEXT_FACTORY and Context.PROVIDER_URL.
You can refer to the sample client at the following location:Writing an ejb client


apigee, a better way to API!
Micheal John
Ranch Hand

Joined: Nov 01, 2006
Posts: 344
Thanks for your reply Nitesh...
I am wondering how come the authors of Head First EJB not mentioned anything about this and whether without the properties on InitialContext it will work(optional)?
Gowher Naik
Ranch Hand

Joined: Feb 07, 2005
Posts: 643
For me it is working without properties on InitialContext.
I am using j2sdkee1.3.1 and jdk1.3.1_19
Nitesh Kant
Bartender

Joined: Feb 25, 2007
Posts: 1638

I dont think that without the properties the initial context can be created.
You can see the Initial context javadocs for the details. Probably, you have the properties available in some property file in the classpath.
Micheal John
Ranch Hand

Joined: Nov 01, 2006
Posts: 344
hi gowher,

Can you send me the link where you downloaded the J2EE1.3 server. I have searched but couldn't get that, so i have downloaded the J2EE server 8.0.. i think it's 1.4 and installed it.. If I have 1.3, then it will be nice..
 
 
subject: Problem witth NoInitialContextException
 
Similar Threads
Cannot able to run the advice aplication..any help!!
How to resolve NoInitialContextException?
Class not found error when running the trial example from Headfirst book
running EJB gives exception in 'main' of Client
On running a stand alone client there is no output