tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Tomcat+OpenEJB deploying ear files
Date Sat, 09 May 2009 18:52:33 GMT

On May 9, 2009, at 8:47 AM, Marcelo de Oliveira Dias wrote:

> Hi folks,
>
> I'm new with EJB, and I still have easy questions.
> Can I deploy EAR files into Tomcat+OpenEJB? Or just collapsed EAR?

Both work fine.  Just use the webapps/ directory like you would a .war  
file.

> How can I find my EJB deployed with EAR files into Tomcat+OpenEJB from
> another vm?
>
> Tomcat is running on port 8080.
> I tried this without success.
>
> Properties p = new Properties();
> p.put("java.naming.factory.initial",
> "org.apache.openejb.client.RemoteInitialContextFactory");
> p.put("java.naming.provider.url", "ejbd://localhost:8080");
> InitialContext ctx = new InitialContext(p);
> Object ref = ctx.lookup("MyEjb");
> MyEjb ejb = (MyEjb)PortableRemoteObject.narrow(ref,MyEjb.class);

Try creating the InitialContext like this:

   Properties p = new Properties();
   p.put("java.naming.factory.initial",  
"org.apache.openejb.client.RemoteInitialContextFactory");
   p.put("java.naming.provider.url", "http://127.0.0.1:8080/openejb/ 
ejb");

   InitialContext ctx = new InitialContext(p);

As a side note, with OpenEJB you don't need the  
"PortableRemoteObject.narrow" call and can skip it if you don't want it.

Hope this helps!

-David


Mime
View raw message