[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

--------------------------------------------------------------
Hello,
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 :

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


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

I'd appreciate any inputs. Thanks.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/748814#748814]

Start a new discussion in JNDI and Naming at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- 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