That's too easy!
 
Now why didn't I think of that!?
 
Works great;  Problem solved.  Thank you both,  Romain and Jonathan!

>>> On 9/29/2011 at  1:36 PM, Jonathan Gallimore <jonathan.gallim...@gmail.com> 
>>> wrote:
Hi Frank,

I think all you need to do is use http://localhost:8080/openejb/ejb as the
provider URL (swap 8080 for your http port if its different):

Properties p = new Properties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
p.setProperty(Context.PROVIDER_URL, "http://localhost:8080/openejb/ejb";);
InitialContext ic = new InitialContext(p);

Hope that helps.

Jon

On Thu, Sep 29, 2011 at 9:29 PM, Frank Brown <bro...@stancounty.com> wrote:

> I am new to OpenEJB.
>
> I have deployed a legacy EJBModule several different ways, with varying
> degrees of success:
>
> 1. deployed myEJB.jar to OpenEJB standalone server.  Accessed the EJB's
> remotely from a webapp and a java client.
> This works fairly well, although I haven't achieved 100% success from all
> clients.
>
> 2. installed TomEE, deployed myWebApp.war to TomEE, with myEJB.jar in
> myWebApp/WEB-INF/lib.
> I am able to access the EJB's from the webapp using both
> LocalInitialContextFactory and  RemoteInitialContextFactory,
> but I can't access the EJB's from the java client using
>  RemoteInitialContextFactory.
>
>
> When I attempt to access an EJB from the client (on the same computer), I
> get this error:
>
>
> In CLIENT'S STDERR.LOG:
> org.apache.openejb.client.StickyConnectionStrategy connect
> WARNING: Failover: Cannot connect to server(s):ejbd://localhost:4201
> Exception: Cannot connect to server 'ejbd://localhost:4201'.
> Check that the server is started and that the specified serverURL is
> correct..  Trying next.
>
> In CLIENT'S STDOUT.LOG:
>
> **getSecurityBean(): ProviderURL:ejbd://localhost:4201
> **getSecurityBean():
> ContextFactory:org.apache.openejb.client.RemoteInitialContextFactory
> Looking up context: gov.stancounty.itsabouttime.ejb.SecurityHome
> EXCEPTION: ==========Application.getSecurityBean()==============
> Cannot lookup '/gov.stancounty.itsabouttime.ejb.SecurityHome'.
> javax.naming.NamingException: Cannot lookup
> '/gov.stancounty.itsabouttime.ejb.SecurityHome'.
> [Root exception is java.rmi.RemoteException: Unable to connect; nested
> exception is:
>  java.rmi.RemoteException: Cannot connect to any servers: Server #0:
> ejbd://localhost:4201]
>  at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:224)
>  at javax.naming.InitialContext.lookup(Unknown Source)
>  at
> gov.stancounty.itsabouttime.util.Application.getSecurityBean(Application.java:607)
>  at gov.stancounty.itsabouttime.gui.Login.init(Login.java:151)
>  at gov.stancounty.itsabouttime.gui.Login.<init>(Login.java:89)
>  at
> gov.stancounty.itsabouttime.gui.AdminConsole.main(AdminConsole.java:1110)
> * openejb log shows it deploys
> jndiname=gov.stancounty.itsabouttime.ejb.SecurityHome
> * I can go to http://localhost:8080/openejb and browse the EJB's and see
> it and invoke it.
> * I access this same bean from the webapp without any problem.
> * I get a similar error when I try this provider URL:
> http://localhost:4204/ejb 
>
> I'm guessing it has to do with either or both of these:
> 1.  openejb.embedded.remoteable (where does this property go?  How do I
> tell if openejb is finding it?)
> 2.  hostname/ipaddress that openejb binds to?
>
> Can anyone shed some light on this problem?
>
>
>

Reply via email to