What you need to do is to bind the EJB References in the WAR to actual
EJBs. I'm afraid that I don't know how to do that in the RI. However:

Check that the jar is in the libs path of the WAR:

WEB-INF/lib/xxxx.jar

See in the manuals of the RI how you bind an EJB Reference to an actual
bean. It usually involves using the ejb-link tag in the web.xml file. If
you're deploying everything within the same ear then you should use the
ejb-ref tag(I think you are) and the most usual problem is the lack of
the ejb-link tag or a typo in its value.

If you're planning to connect to a remote server yourself, then you
don't need the EJB Ref, just the classes(and code to connect, like the
sample I provided earlier).

HTH,

Juan Pablo Lorandi
Chief Software Architect
Code Foundry Ltd.
[EMAIL PROTECTED]

Barberstown, Straffan, Co. Kildare, Ireland.
Tel: +353-1-6012050  Fax: +353-1-6012051
Mobile: +353-86-2157900
www.codefoundry.com


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:psalazar@;vitoria.intra.cet.pt] On Behalf Of psalazar
> Sent: Tuesday, October 29, 2002 12:43 PM
> To: Juan Pablo Lorandi
> Cc: EJB Users List
> Subject: Re: acessing ejb in jsp
>
>
> Greetings to all,
>
> Hi Juan,
>
> As you said to invoke a EJB I would need at least the
> Remote/Home interfaces in the application. Technically, when
> I put my jar file with
> the remote interfaces in the lib directory of my web
> application (WAR),
> when I verify EAR in deploytool of J2ee1.3.1, it raises a
> FAIL saying that
> it doesn't find the classes in question in JSP tags. How
> should I solve
> this problem?
>
> thx,
> Pedro Salazar.
>
> PS. I'm not from M$ world and I not interested to be in ... :)
>
> On Mon, 28 Oct 2002, Juan Pablo Lorandi wrote:
>
> > Hi Pedro,
> >
> > The spec doesn't describe or address extra-ear component
> > interaction(yet), altough it does require support for
> RMI-IIOP as the
> > standard transport for enterprise class RPC, so this
> depends entirely
> > on the app server you use. I'm afraid I'm unfamiliar with
> the RI, but
> > at deploy time many servers will allow you to link to components in
> > different machines/ears.
> >
> > The easiest(but not necessarily the one that suits you best) way
> > around this is to include the EJB jar in the EAR you're deploying.
> >
> > Should you come from the M$ world, perhaps you're familiar with
> > COM/MTS/COM+. If you use VB, you'll use:
> >
> > CreateObject(ProgId, ServerName)
> >
> > Where ProgId is the "friendly name" of a component, e.g.:
> > "ADOR.Recordset", "CDO.Contact", etc. A map that allows to identify
> > components based on the friendly name is in the Wi And
> > ServerName(optional) is the resolvable name of a server, e.g.:
> > "MAINSERVER","201.10.20.30", etc.
> >
> > In J2EE, we have JNDI to replace the Registry, and rely on
> the OS host
> > resolving hosts. Even if your app server doesn't include
> support for
> > linking references to beans in different machines/ears, you should
> > still be able to get references to EJBs (remote/home interfaces) by
> > manually connecting to the JNDI implementation on a particular
> > server(here's an example that works in Orion/OC4J):
> >
> > /**
> >    * Gets the context.
> >    * @param environment Should be the prefix in the properties file
> > (i.e.
> > development,test,production)
> >    * @returns The jndiContext to the App Server.
> >    */
> >   protected Context getContext(String environment)
> >   {
> >     if(jndiContext == null)
> >     {
> >         jndiContext.close();
> >     }
> >       try
> >       {
> >         String applicationServer =
> > "com.evermind.server.ApplicationClientInitialContextFactory";
> >         String applicationServerUrl = "ormi://fred"); //will use
> > Orion's RMI at machine fred
> >         String appServerLogin = "user";
> >         String appServerPassword = "1234";
> >
> >         Hashtable props = new Hashtable();
> >         props.put("java.naming.factory.initial", applicationServer);
> >         props.put("java.naming.provider.url", applicationServerUrl);
> >         props.put("java.naming.security.principal", appServerLogin);
> >         props.put("java.naming.security.credentials",
> > appServerPassword);
> >
> >         jndiContext = new InitialContext(props);
> >       }
> >       catch(Exception e)
> >       {}
> >     }
> >     return jndiContext;
> >   }
> >
> > Basically, this code will return a JNDI Context to the
> machine "fred",
> > provided that the credentials provided are valid.
> >
> > The other thing you need to remember is that while you're
> not required
> > to physically import a component you want to use, the client
> > application(a web app in this case) needs to have access to the
> > interfaces your component implements, just like in COM(TLB, type
> > libraries). Therefore your web app, if not in the same ear,
> will need
> > to have the Remote and Home interfaces in their classpath.
> >
> > Finally, if you deploy your EJBs in a different EAR than
> your web app,
> > chances are that all communication between the two cannot
> benefit from
> > Local interfaces, thereby resulting in a more slow
> application. Local
> > interfaces leverage the fact that client and server are
> colocated, and
> > running in the same JVM, to implement speed gains on the
> > communication. It's also much like COM, that in method invocation
> > values and objects passed must be marshalled. Local
> interfaces allow
> > the marshalling to be simpler, therefore resulting in more
> efficient
> > code.
> >
> >
> > HTH,
> >
> >
> > Juan Pablo Lorandi
> > Chief Software Architect
> > Code Foundry Ltd.
> > [EMAIL PROTECTED]
> >
> > Barberstown, Straffan, Co. Kildare, Ireland.
> > Tel: +353-1-6012050  Fax: +353-1-6012051
> > Mobile: +353-86-2157900
> > www.codefoundry.com
> >
> >
> > > -----Original Message-----
> > > From: A mailing list for Enterprise JavaBeans development
> > > [mailto:EJB-INTEREST@;JAVA.SUN.COM] On Behalf Of psalazar
> > > Sent: Monday, October 28, 2002 6:47 PM
> > > To: [EMAIL PROTECTED]
> > > Subject: acessing ejb in jsp
> > >
> > >
> > > Greetings,
> > >
> > > I created a EJB and I deployed it in my J2EE (j2ee1.3.1)
> inside in
> > > EAR. Then I created a web application and i put it inside
> of another
> > > EAR. But then when I verify it on deploytool, it throws a FAIL
> > > message saying it cannot find the ejb classes that I use
> in my JSP
> > > (web application).
> > >
> > > So my question is, for I use a EJB from another EAR, must I in my
> > > web application put all classes files (jar maybe?) from
> that EJB? If
> > > true it doesn't makes much sense. I should be able to
> refer another
> > > EJB without import *physically* my other EJB to my EAR,
> shouldn't I?
> > >
> > > thanks,
> > > Pedro Salazar
> > > --
> > > pedro salazar (pt-inovacao) <[EMAIL PROTECTED]>
> > >
> > > ==============================================================
> > > =============
> > > To unsubscribe, send email to [EMAIL PROTECTED] and
> include in
> > > the body of the message "signoff EJB-INTEREST". For general help,
> > > send email to [EMAIL PROTECTED] and include in the
> body of the
> > > message "help".
> > >
> > >
> >
> >
> ======================================================================
> > =====
> > To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body
> > of the message "signoff EJB-INTEREST".  For general help,
> send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
> >
>
> --
> pedro salazar (pt-inovacao) <[EMAIL PROTECTED]>
>
> -----BEGIN PGP PUBLIC KEY BLOCK-----
> Version: GnuPG v1.0.6 (GNU/Linux)
> Comment: For info see http://www.gnupg.org
>
> mQGiBD1AA8URBAD6f+Ttr6Yat6UukbUOl6RYHrdgIFlVXBHnAdJ3eZvWQY6Fx2T0
> C0X6Gk5QuX4AAZ8YKTH8W8ICSD0arT04aDcEg28Xivrd645/1OOJikxXqowE89Pu
> +5BrFIBCd2npybPn2PEWB/R2iTMCiVsMSw9D+mOkNQ78T8bEXfynL6oiawCgpcGq
> MElx0/Yvl24fxe5W5t1rZ9UEAKO7RWyaW03Pc/LE8EGnrlaXRASAT9OOIpiFN6cu
> 0sBLjEu4a4zshF+pvkPEANUy6x93UdpBR2oq6EqvHzNFpFpe/fFu0sdY2ZdJzSiX
> vY2UXiA0hxJZu2mhF3O5A3PHm05Elv9crMj7foTo52uJnyf27IoHUa5giynflJ+P
> YiW1A/48ql9BoivKRIPGMyWOjbidkPNShxS6/5qjSd94EzQ+xlv3lxbs6RBok0FT
> GMhfH1ThnUHZ6znOxfpI89enkvttBBVxymwnGeEsMPPjseY+96wzCRF0UhjlH0a4
> kiTb3lDE2LmiRJGAH7TErLVNe99aGaGnp0yhZpoWBsjFFv/8iLQ7UGVkcm8gU2Fs
> YXphciAocHQtaW5vdmFjYW8pIDxwZWRyby1iLXNhbGF6YXJAcHRpbm92YWNhby5w
> dD6IXQQTEQIAHQUCPUADxQUJAeEzgAULBwoDBAMVAwIDFgIBAheAAAoJEA4SnjHY
> A7xhNwkAninS2GoP9v+zazP2Ww31p4r7WkFVAKCCFBfKkspAw+NZFIabjWTMWRtn
> 7LkBDQQ9QAPMEAQAneAOhdRIUGho+pDiqOTK0rrEWxySK46KHrIFxdP6ogO841uw
> tzkGnESfpetnamTeJwmCnsDeqTu77rjJURVdWLaLss5b6dQjdAtc33bbTKCWzzRH
> OFKwtqn35qO60CfuKU0Gw28TwcL7uyzJntIT8B4H8JHCGmsUqh+nYJLWvVcABRED
> /jWqY8Nu9dc/nfqX3sRcLlO0KCiMaQYB4W5awBuVTdOiiMtmi2O/3xB+14Aj/0E6
> qg/ieQc6plEax8RsFmrSTbUneguTCKdHFuR9TRsvHcWuMJmrSZdsNraM20uMJTcp
> AGi3ADPq/DKqxxl6g0Snvq1Cp4mQXB+773kko4sg26UkiEwEGBECAAwFAj1AA8wF
> CQHhM4AACgkQDhKeMdgDvGF9GACbBM4QWGbcwfLy/M5MqPsYge19yHQAni2BMH50
> wq+B1DsueAoAeOWs7nNH
> =E9NO
> -----END PGP PUBLIC KEY BLOCK-----
>
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to