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