=========================================================================== To unsubscribe, send email to listserv@java.sun.com and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@java.sun.com and include in the body of the message "help".Hi, I'm a new one working with J2EE. I'm developing an application and I need to access the EJBs from my client (a Java application).
This is the code of my client (a test one):
package clients;import java.util.Properties;import javax.rmi.PortableRemoteObject;import javax.naming.*;class Client{public static void main(String[] args){Properties env = new Properties();// Define properties and JNDI names lookup location.env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");env.setProperty("java.naming.provider.url", "localhost:1099");env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");try{// Bring the name contextInitialContext jndiContext = new InitialContext(env);System.out.println("Contexto Disponible");// Bring the referente to the EJBObject ref = jndiContext.lookup("Calculo");System.out.println("Se encontrĂ³ Referencia del EJB!");// Bring the referente to the "Home Interface "InteresesHome home = (InteresesHome)PortableRemoteObject.narrow (ref, InteresesHome.class );// Create an object from the "Home Interface"Intereses interes = home.create();// Call the functionSystem.out.println ("InterĂ©s de 10,000 Capital, a tasa 10%, bajo 2 plazos anuales:");System.out.println(interes.calcularInteres(10000, 0.10, 2));}catch(Exception e){System.out.println( e.toString());}}}When I execute this, there is an error. It says : javax.naming.NoInitialContextException : Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException : org.jnp.interfaces.NamingContextFactory]
Would some of you be so kind to help me fixing that? What sould I do?