Wrox Home  
Search P2P Archive for: Go

  Return to Index  

j2ee thread: How to access J2EE ejb bean from Java application


Message #1 by a7k7@h... on Thu, 24 May 2001 20:28:48
Hi Yamini,

The example you gave is for J2EE computer, we are need to access Java 
only(no J2EE) computer. We have to set up path to J2EE JNDI from java 
computer. Essentially we need to set up "java.naming.factory.initial" and
"java.naming.provider.url", but nobody seems to know their value for J2EE 
server.

Regards
Anatole


>From: "Yamini Krishnamurthy" <yamini.krishnamurthy@i...>
>Reply-To: "Java 2 Enterprise Edition" <j2ee@p...>
>To: "Java 2 Enterprise Edition" <j2ee@p...>
>Subject: [j2ee] Re: How to access J2EE ejb bean from Java application
>Date: Sun, 3 Dec 2000 10:03:24 +0530
>
>
>Hi
>While using EJB you need to remember that to access any of the business
>methods you need to make use of the remote interface instance. So, in your
>java application create a home interface instance, using the context and
>then use the home interface instance to create the remote interface.
>Essentially your code should look like this:
>
>         Context ctx = new InitialContext();
>        Object ob = ctx.lookup("lookupname"); //lookup your bean. Give the
>jndi name here
>
>Assuming YourBeanHome is your home interface and YourBeanRemote is your
>remote interface
>        YourBeanhome  home = (YourBeanHome) PortableRemoteObject.narrow(ob 
>,
>YourBeanHome.class);
>        YourBeanRemote remote = home.create();
>
>Now, you can access the business methods as such:
>
>        remote.businessMethod();
>
>
>Regards
>Yamini
>
>
>
>
>----- Original Message -----
>From: <bounce-j2ee-281015@p...>
>To: "Java 2 Enterprise Edition" <j2ee@p...>
>Sent: Friday, May 25, 2001 1:58 AM
>Subject: [j2ee] How to access J2EE ejb bean from Java application
>
>
> >
> >
> > Dears, please help!
> >
> > I need to access ejb bean running in J2EE server from stand-alone Java
> > application. I just have to access this bean and get somw info from it.
> > Thanks.
> >
> > Anatole



  Return to Index