Problema EJB Intereses

Jorge Cardenas
30 de Enero del 2003
Tengo un problemita con la prueba al Ejb Interes me arroja el siguiente error:

javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]

tengo en el CLASSPATH en linux:

/usr/java/j2sdk1.4.1_01/lib/j2ee.jar:/usr/local/jboss-3.0.4/client/jboss-client.jar:/usr/lo
cal/jboss-3.0.4/client/jbosssx-client.jar:/usr/local/jboss-3.0.4/client/jnp-client.jar:/usr
/local/jboss-3.0.4/lib/ejb20.jar

La forma de ejecucion fue lanzar primero el servidor de componentes Jboss y luego tomcat...

no se si me falte alguna configuracion adicional, lo estoy ejecutando en un servlet. Mi cliente es el siguiente:

------------------------------------------------------------------------------------------------------------
import java.io.*;


import javax.servlet.*;
import javax.servlet.http.*;


import javax.naming.*;
import java.util.Hashtable;
import java.util.Properties;

import javax.rmi.PortableRemoteObject;
//import com.web_tomorrow.interest.*;

public class EjbTestServlet extends HttpServlet {

public void doGet (HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {

PrintWriter out;
String title = "Servlet interface to EJB";

// set content type and other response header fields first
response.setContentType("text/html");

// then write the data of the response
out = response.getWriter();

out.println("<HTML><HEAD><TITLE>");
out.println(title);
out.println("</TITLE></HEAD><BODY bgcolor="#FFFFFF">");
out.println("<H1>" + title + "</H1>");
out.println("<H2>Calling EJB...</H2>");

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", "http://server:1099");
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");


/*
env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
env.setProperty(Context.PROVIDER_URL,"http://server:1099");
*/
/*
System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url",
"http://server:1099");
*/
// Enclosing the whole process in a single `try' block is not an ideal way
// to do exception handling, but I don't want to clutter the program up
// with catch blocks
try {
// Get a naming context
Context jndiContext = new InitialContext(env);
out.println("Got context");

// Get a reference to the Interest Bean
Object ref = jndiContext.lookup("interest/Interest");
out.println("Got reference");

// Get a reference from this to the Bean's Home interface
InterestHome home = (InterestHome)
PortableRemoteObject.narrow (ref, InterestHome.class);

// Create an Interest object from the Home interface
Interest interest = home.create();

// call the calculateCompoundInterest() method to do the calculation
out.println ("Interest on 1000 units, at 10% per period, " +
"compounded over 2 periods is:");
out.println (interest.calculateCompoundInterest (1000, 0.10, 2));
} catch(Exception e) {
out.println(e.toString());
}

out.println("</BODY></HTML>");
out.close();
}
}
------------------------------------------------------------------------------------------------------------

Necesito informacion si me puede colaborar al respecto.

Gracias