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&...]