Uso de un EJB desde una aplicacion standalone(WSAD)
Hola:
Soy novato en el tema y estoy tratando de hacer pruebas en el WSAD con los EJB. Pues bien, cree un servlet donde invoco a un EJB, ambos los levanto en el servidor de prueba de WSAD y llamo al servlet desde el explorador y todo funciona de maravillas. Pase a hacer otra prueba desde local, creando una aplicacion standalone que se conectase con el EJB y ahi empiezan los problemas. Levanto el servidor como antes y tengo el sgte codigo en la aplicacion cliente:
Properties p=new Properties();
p.put(Context.PROVIDER_URL, "iiop://localhost:900");
p.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
InitialContext ctx=new InitialContext(p);
Object objref = ctx.lookup(MyEJBRemote);
MyEJBHome homeClass = (MyEJBHome ) PortableRemoteObject.narrow(objref, MyEJBHome.class);
MyEJBRemote remoteClass = homeClass.create();
Esto me compila perfectamente con todos los import necesarios. El jndi.jar lo tengo puesto en:
C:Archivos de programaIBMApplication Developerjrelibext
que es el directorio de ejecucion que usa el WSAD para las app standalone y sin embargo cuando ejecuto me da exception en la linea:
InitialContext ctx=new InitialContext(p);
java.lang.NoClassDefFoundError: com/ibm/rmi/iiop/GIOPVersionException
at com.ibm.CORBA.iiop.ConnectionTable.get(ConnectionTable.java:339)
at com.ibm.CORBA.iiop.GIOPImpl.createRequest(GIOPImpl.java:152)
at com.ibm.CORBA.iiop.GIOPImpl.createRequest(GIOPImpl.java:133)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1080)
at com.ibm.CORBA.iiop.InitialNamingClient.resolve(InitialNamingClient.java:372)
at com.ibm.CORBA.iiop.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:551)
at com.ibm.CORBA.iiop.ORB.resolve_initial_references_remote(ORB.java:1926)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:592)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:352)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:227)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:98)
at com.ibm.ws.naming.util.WsnInitCtx.<init>(WsnInitCtx.java:79)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:135)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:80)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext(CNInitialContextFactory.java:68)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:199)
at pruebas.Particulares.main(Particulares.java:61)
Por favor, ya no se que hacer ni que esta pasando debido a mi poca experiencia con este tema.
Gracias.
Soy novato en el tema y estoy tratando de hacer pruebas en el WSAD con los EJB. Pues bien, cree un servlet donde invoco a un EJB, ambos los levanto en el servidor de prueba de WSAD y llamo al servlet desde el explorador y todo funciona de maravillas. Pase a hacer otra prueba desde local, creando una aplicacion standalone que se conectase con el EJB y ahi empiezan los problemas. Levanto el servidor como antes y tengo el sgte codigo en la aplicacion cliente:
Properties p=new Properties();
p.put(Context.PROVIDER_URL, "iiop://localhost:900");
p.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.ejs.ns.jndi.CNInitialContextFactory");
InitialContext ctx=new InitialContext(p);
Object objref = ctx.lookup(MyEJBRemote);
MyEJBHome homeClass = (MyEJBHome ) PortableRemoteObject.narrow(objref, MyEJBHome.class);
MyEJBRemote remoteClass = homeClass.create();
Esto me compila perfectamente con todos los import necesarios. El jndi.jar lo tengo puesto en:
C:Archivos de programaIBMApplication Developerjrelibext
que es el directorio de ejecucion que usa el WSAD para las app standalone y sin embargo cuando ejecuto me da exception en la linea:
InitialContext ctx=new InitialContext(p);
java.lang.NoClassDefFoundError: com/ibm/rmi/iiop/GIOPVersionException
at com.ibm.CORBA.iiop.ConnectionTable.get(ConnectionTable.java:339)
at com.ibm.CORBA.iiop.GIOPImpl.createRequest(GIOPImpl.java:152)
at com.ibm.CORBA.iiop.GIOPImpl.createRequest(GIOPImpl.java:133)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1080)
at com.ibm.CORBA.iiop.InitialNamingClient.resolve(InitialNamingClient.java:372)
at com.ibm.CORBA.iiop.InitialNamingClient.resolve_initial_references(InitialNamingClient.java:551)
at com.ibm.CORBA.iiop.ORB.resolve_initial_references_remote(ORB.java:1926)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:592)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:352)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:227)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:98)
at com.ibm.ws.naming.util.WsnInitCtx.<init>(WsnInitCtx.java:79)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContext(WsnInitCtxFactory.java:135)
at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:80)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext(CNInitialContextFactory.java:68)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:669)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:199)
at pruebas.Particulares.main(Particulares.java:61)
Por favor, ya no se que hacer ni que esta pasando debido a mi poca experiencia con este tema.
Gracias.
Debes arrancar tus clases de test con el mismo nivel JDK que el del servidor WAS en WSAD
Mira al final del siguiente artículo de IBM en el que te dice cómo hacerlo:
http://www-106.ibm.com/developerworks/websphere/library/techarticles/0203_deboer/deboer.html#IDANVM2B
flash gordon
Mira al final del siguiente artículo de IBM en el que te dice cómo hacerlo:
http://www-106.ibm.com/developerworks/websphere/library/techarticles/0203_deboer/deboer.html#IDANVM2B
flash gordon
