[jboss-user] [JNDI and Naming] - Local lookup failing

shinosha do-not-reply at jboss.com
Wed Jul 18 12:10:07 EDT 2012

shinosha [https://community.jboss.org/people/shinosha] created the discussion

"Local lookup failing"

To view the discussion, visit: https://community.jboss.org/message/748814#748814

I'm a kinda newbie with JEE and Jboss 7 and I'm currently working on a project for school. I work with JBoss 7.1.1 and Eclipse. I just finished a part of my DAO and want to test it using TestNG. Since I use Struts 2 I can't really use dependecy injection, so I thought about Service Locator. The problem is I get java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory when running the test method ( http://pastebin.com/c16kQz5f full stacktrace) which triggers my delegate business method using my service locator.

The properties for the locator :

private ServiceLocator() throws NamingException
 Properties props = new Properties();
 props.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
 props.put(Context.PROVIDER_URL, "jnp://localhost:1099"); 
context = new InitialContext(props);

The JNDI string :
dao = (UtilisateurHome) ServiceLocator.getInstance().getService("java:global/businessLayer/UtilisateurHome");

I'd appreciate any inputs. Thanks.

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120718/c7ad3bbf/attachment.html 

More information about the jboss-user mailing list