problemas con ejb y jboss
hola necesito ayuda con esto de los ejb, estoy utilizando jboss y trate de hacer el ejemplo que aparece en http://www.osmosislatina.com/jboss/session.htm
y al llegar al ultimo paso, la ejecucion, me aparece el siguiente mensaje
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
por favor indicarme el error o donde podria buscar mejor informacion. de antemano gracias
y al llegar al ultimo paso, la ejecucion, me aparece el siguiente mensaje
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
por favor indicarme el error o donde podria buscar mejor informacion. de antemano gracias
Yicart: Se requiere definir las propiededes y ubicacion de busqueda de Nombres JNDI. Anexo programa ClienteInteres corregido :
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
import javax.naming.*;
import intereses.*;
class ClienteInteres
{
public static void main(String[] args)
{
Properties env = new Properties();
// Definir las propiededes y ubicacion de busqueda de Nombres JNDI.
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
{
// Traer el Contexto de Nombre
InitialContext jndiContext = new InitialContext(env);
System.out.println("Contexto Disponible");
// Traer la Referencia del EJB
Object ref = jndiContext.lookup("Calculo");
System.out.println("Se encontro Referencia del EJB!");
// Traer la referencia del "Home Interface "
InteresesHome home = (InteresesHome)
PortableRemoteObject.narrow (ref, InteresesHome.class);
// Create un Objeto a partir del "Home Interface"
Intereses interes = home.create();
// Llamar la funcion
System.out.println("Interes 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());
}
}
}
Suerte
César
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
import javax.naming.*;
import intereses.*;
class ClienteInteres
{
public static void main(String[] args)
{
Properties env = new Properties();
// Definir las propiededes y ubicacion de busqueda de Nombres JNDI.
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
{
// Traer el Contexto de Nombre
InitialContext jndiContext = new InitialContext(env);
System.out.println("Contexto Disponible");
// Traer la Referencia del EJB
Object ref = jndiContext.lookup("Calculo");
System.out.println("Se encontro Referencia del EJB!");
// Traer la referencia del "Home Interface "
InteresesHome home = (InteresesHome)
PortableRemoteObject.narrow (ref, InteresesHome.class);
// Create un Objeto a partir del "Home Interface"
Intereses interes = home.create();
// Llamar la funcion
System.out.println("Interes 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());
}
}
}
Suerte
César
