Provider URL:
http://localhost:8080/tomee/ejbTHANK YOU.
*Effectively I am being SHOWN the end point url to be used in the
calling client when EJB deployed in Tomee as seen in the code *
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
props.put(Context.PROVIDER_URL, "
http://127.0.0.1:8080/tomee/ejb");
*Creating an EJB in Eclipse, deploying on tomee and calling it remotely
using HTTP/HTTPS is my final objective.*
*Is this client code up to date ?*
Context ctx = new InitialContext(props);
final Object ref = ctx.lookup("CalculatorImplRemote");
Calculator calc = (Calculator) PortableRemoteObject.narrow(ref,
Calculator.class);
double result = calc.add(10, 30);
public class JNDILookupTest {
@Test
public void test() {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
props.put(Context.PROVIDER_URL, "
http://127.0.0.1:8080/tomee/ejb");
try {
Context ctx = new InitialContext(props);
System.out.println("Found context " + ctx);
final Object ref = ctx.lookup("CalculatorImplRemote");
Calculator calc = (Calculator) PortableRemoteObject.narrow(ref,
Calculator.class);
double result = calc.add(10, 30);
Assert.assertEquals(40, result, 0.5);
} catch (Exception e) {
e.printStackTrace();
}
}
https://www.backbutton.co.uk/ <
http://Backbutton.co.uk>
¯\_(ツ)_/¯
♡۶Java♡۶RMI ♡۶
<
http://www.backbutton.co.uk>
On Fri, 21 Aug 2020 at 22:03, David Blevins <
[hidden email]> wrote:
> > On Aug 18, 2020, at 11:37 AM, Zahid Rahman <
[hidden email]> wrote:
> >
> > When I select the URL Provider URL:
http://localhost:8080/tomee/ejb> >
> > I get a blank page even though I have the struts application example
> > application installed.
> >
> >
> > *Am I supposed to get a blank page ?*
>
> Yes. You can ignore that URL unless you need to do remote EJB calls over
> HTTP. If you do need that, that end point will effectively allow you to
> use OpenEJB's binary protocol layered over HTTP. To use it you point EJB
> clients to that endpoint when constructing the InitialContext and then they
> will open a socket to that URL, send the appropriate HTTP headers and then
> immediately switch to binary communication.
>
> It doesn't have any relationship to Struts, HTML, REST or any kind of text
> or human readable/consumable information or UI.
>
>
> -David
>
>