Programación en castellano
Inicio > Foros > Java (básico) > Problemas jboss, ejb y corba
-Foros de debate

Java (básico)
Lista de foros | Lista de mensajes de este foro

Privacidad: Recuerde que la información escrita en los foros de programación es 100% pública y que su ip será registrada asociada a su mensaje. Si encuentra un mensaje fuera de lugar, por favor, notifiquelo para su revisión y eliminación.

Problemas jboss, ejb y corba
Enviado por yamilj el día 27 de abril de 2008

hola me esta saliendo este error cuando ejecuto la clase cliente

Exception in thread "main" java.lang.ClassCastException
at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at javax.rmi.PortableRemoteObject.narrow(Unknown Source)
at HelloClient.main(HelloClient.java:47)
Caused by: java.lang.ClassCastException: $Proxy0 cannot be cast to org.omg.CORBA.Object
... 3 more


la clase cliente es esta:


import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;



/**
* This class is an example of client code that invokes
* methods on a simple stateless session bean.
*/
public class HelloClient {
public static void main(String[] args) throws Exception {
/*
* Setup properties for JNDI initialization.
*
* These properties will be read in from
* the command line.
*/
System.setSecurityManager(new java.rmi.RMISecurityManager());

Properties props = new Properties();
props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
props.put("java.naming.provider.url", "jnp://localhost:1099");
/*
* Obtain the JNDI initial context.
*
* The initial context is a starting point for
* connecting to a JNDI tree. We choose our JNDI
* driver, the network location of the server, etc.
* by passing in the environment properties.
*/
Context ctx = new InitialContext(props);

/*
* Get a reference to the home object - the
* factory for Hello EJB Objects
*/
Object obj = ctx.lookup("examples/ejb21/HelloHome");
/*
* Home objects are RMI-IIOP objects, and so
* they must be cast into RMI-IIOP objects
* using a special RMI-IIOP cast.
*
* See Appendix A for more details on this.
*/
HelloHome home = (HelloHome) javax.rmi.PortableRemoteObject.narrow( obj, HelloHome.class);
/*
* Use the factory to create the Hello EJB Object
*/
Hello hello = (Hello) home.create();
/*
* Call the hello() method on the EJB object. The
* EJB object will delegate the call to the bean,
* receive the result, and return it to us.
*
* We then print the result to the screen.
*/
System.out.println(hello.hello());
/*
* Done with EJB Object, so remove it.
* The container will destroy the EJB object.
*/
hello.remove();
}
}

de verdad ya no se cual es el error. He probado de todo y nada.

gracias de antemano.

 

Tienda
Patrocinados
 

Copyright © 1999-2007 Programación en castellano. Todos los derechos reservados.
Formulario de Contacto - Datos legales - Publicidad

Hospedaje web y servidores dedicados linux por Ferca Network

red internet: musica mp3 | logos y melodias | hospedaje web linux | registro de dominios | servidores dedicados
más internet: comprar | recursos gratis | posicionamiento en buscadores | tienda virtual | gifs animados