Java - problema con JNDI y EJB's

 
Vista:

problema con JNDI y EJB's

Publicado por luis (88 intervenciones) el 15/11/2006 23:40:43
Hola estoy construyendo un stateless bean manualmente (sin ningun IDE creando el JAR desde el prompt) pero al momento de buscar la inteface en el JNDI service me despliega la siguiente excepcion:

Exception in thread "main" javax.naming.CommunicationException: Can't find SerialContextProvider

alguien sabe donde esta el error? gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:problema con JNDI y EJB's porcierto

Publicado por luis (88 intervenciones) el 15/11/2006 23:46:53
aqui esta el codigo fuente:

//LOCAL
import java.rmi.RemoteException;
import javax.ejb.EJBHome;
import javax.ejb.CreateException;
public interface PerfectTimeHome extends EJBHome
{
public PerfectTime create() throws CreateException, RemoteException;
}

//REMOTA
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface PerfectTime extends EJBObject
{
public long getPerfectTime() throws RemoteException;
}

//BUSSINES LOGIC
import java.rmi.*;
import javax.ejb.*;

public class PerfectTimeBean implements SessionBean

{
private SessionContext sessionContext = null;

//return current time

public long getPerfectTime()
{
return System.currentTimeMillis();
}

// EJB methods
public void ejbCreate()
throws CreateException {}
public void ejbRemove() {}
public void ejbActivate() {}
public void ejbPassivate() {}
public void
setSessionContext(SessionContext ctx)
{
sessionContext = ctx;
}
}



//cliente (APLICACION)
public class PerfectTimeClient
{
public static void main(String[] args) throws Exception
{



// Get a JNDI context using
// the JNDI Naming service:
javax.naming.Context context = new javax.naming.InitialContext();

// Look up the home interface in the
// JNDI Naming service:
Object ref = context.lookup("perfectTime");

// Cast the remote object to the home interface:
PerfectTimeHome home = (PerfectTimeHome)
javax.rmi.PortableRemoteObject.narrow(ref, PerfectTimeHome.class);

// Create a remote object from the home interface:
PerfectTime pt = home.create();

// Invoke getPerfectTime()
System.out.println("Perfect Time EJB invoked, time is: " +
pt.getPerfectTime() );
}
}

<!-- ejb:jar -->
<?xml version="1.0" encoding="US-ASCII" ?>
<!DOCTYPE ejb-jar (View Source for full doctype...)>
<ejb-jar>
<description>Example for Chapter 15</description>
<display-name />
<small-icon />
<large-icon />
<enterprise-beans>
<session>
<ejb-name>PerfectTime</ejb-name>
<home>PerfectTimeHome</home>
<remote>PerfectTime</remote>
<ejb-class>PerfectTimeBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<ejb-client-jar />
</ejb-jar>


GRACIAS
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar