Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Initialcontext problem!!

 
Ankur Jain
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was trying the HF EJB advicebean example in chap.1.
everything was going fine till the last step,when I ran the AdviceClient,this was what i got:
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
Please help me out.
Thanx in advance.
 
Marcelo Sousa Ancelmo
Ranch Hand
Posts: 498
Eclipse IDE Fedora Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I don't have HF EJB, but the error occur because you doesn't have the right properties, or classpath settings for your client.
Try to create a jndi.properties file whit the following arguments:


And put it in the classpath of your client app.

Note that this example is for JBoss, you have to provide the right values for Initial Factory and Connection URL for the conteiner that you are using, also you need the jar that contain the class for Initial Factory in your client classpath.

There are other ways to pass that values, like command Line option -D and, in your code, passing as an argument for your Initial Context

Regards,
[ June 14, 2004: Message edited by: Marcelo Sousa Ancelmo ]
 
Dale Seng
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you also define your properties within your code, and put that as a parameter on when you instantiate your initial context?

Properties myProp = ...
// set values
your new InitialContext(myProp);

--Dale--
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic