Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic


Nuno Martins
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to set jndi properties from Properties objects, or must be given a file?
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); p.put(javax.naming.Context.PROVIDER_URL,"jnp://localhost:1099");
ctx = new InitialContext(p);
ut = (UserTransaction) ctx.lookup("UserTransaction");
I'am asking this because if with the first possibility, I get this
javax.transaction.SystemException: java.lang.RuntimeException: UT factory lookup 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
I can't define jndi properties in jvm.
Any ideias?
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic