• Post Reply Bookmark Topic Watch Topic
  • New Topic

ejb client test code

 
Shining Xia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,all
I have deployed EJB under Jboss.
Then I run the EJB client test code,and failed:
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
.....
Context ctx=new InitialContext();
connectDB Home=(connectDB)ctx.lookup("connectDB"); //I'm sure this statement caused error
......
I have configured the jidi.properties,is there any things I haven't notice?
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your jndi.properties file look like, and is it on your classpath?
BTW, we have a naming policy here at JavaRanch where all publicly displayed names take the form, "Firstname surname". Could you please change yours to bring it into line?
Thanks in advance and we hope that you enjoy your stay at the ranch!
Cheers
Simon
 
Shining Xia
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK,thanks for your friendly advice.
I have set jndi.properties on CLASSPATH,but it still throws javax.naming.NoInitialContextException
I must add the follow code :
System.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url", "localhost:1099");
But I think it's too bad to specify the "java.naming.provider.url" in the program.
I'm puzzled...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!