You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Frank Brown <BR...@stancounty.com> on 2011/09/29 22:29:58 UTC

how to use openejb.embedded.remoteable in TomEE

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?  
 
 

Re: how to use openejb.embedded.remoteable in TomEE

Posted by Frank Brown <BR...@stancounty.com>.
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 <jo...@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 <BR...@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?
>
>
>

Re: how to use openejb.embedded.remoteable in TomEE

Posted by Jacek Laskowski <ja...@japila.pl>.
On Fri, Sep 30, 2011 at 6:31 PM, stratwine <to...@gmail.com> wrote:
> I came across this at this page -  http://openejb.apache.org/3.0/clients.html
> http://openejb.apache.org/3.0/clients.html  I guess referring to this link
> in relevant sections of other pages would make it easy to find.

Thanks Vishwa. I seem to be lacking visiting the website more often :)

Jacek

-- 
Jacek Laskowski
Java EE, functional languages and IBM WebSphere - http://blog.japila.pl
Warszawa JUG conference = Confitura (formerly Javarsovia) :: http://confitura.pl
"Hoping to save time by spending it" by David Blevins (Apache OpenEJB)

Re: how to use openejb.embedded.remoteable in TomEE

Posted by stratwine <to...@gmail.com>.
I came across this at this page -  http://openejb.apache.org/3.0/clients.html
http://openejb.apache.org/3.0/clients.html  I guess referring to this link
in relevant sections of other pages would make it easy to find.

-Vishwa

--
View this message in context: http://openejb.979440.n4.nabble.com/Re-how-to-use-openejb-embedded-remoteable-in-TomEE-tp3859475p3860341.html
Sent from the OpenEJB Dev mailing list archive at Nabble.com.

Re: how to use openejb.embedded.remoteable in TomEE

Posted by Jacek Laskowski <ja...@japila.pl>.
On Thu, Sep 29, 2011 at 10:36 PM, Jonathan Gallimore
<jo...@gmail.com> wrote:

> 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.

Is this somewhere on the website? I think we should add it if it's
not. I volunteer to add it, but am asking for the place and moreover a
confirmation that it's not already there.

Jacek

-- 
Jacek Laskowski
Java EE, functional languages and IBM WebSphere - http://blog.japila.pl
Warszawa JUG conference = Confitura (formerly Javarsovia) :: http://confitura.pl
"Hoping to save time by spending it" by David Blevins (Apache OpenEJB)

Re: how to use openejb.embedded.remoteable in TomEE

Posted by Jonathan Gallimore <jo...@gmail.com>.
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 <BR...@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?
>
>
>

Re: how to use openejb.embedded.remoteable in TomEE

Posted by Romain Manni-Bucau <rm...@gmail.com>.
hi,

in tomcat/tomee we use openejb webapp to do it, try http://localhost:<tomcat
port - probably 8080>/openejb/ejb/

- Romain

2011/9/29 Frank Brown <BR...@stancounty.com>

> 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?
>
>
>