You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by Mark Lybarger <Ma...@CBC-Companies.com> on 2003/10/24 22:14:22 UTC

Getting reference to ejb in other container

Here's my setup.  I have ejb1 that I'm testing with cactus.  ejb1 uses ejb2,
via remote interface, that exists in a separate container.  ejb2, is
basically a dao, findOrderItemsBy( String ProductCode), etc.  To test ejb1,
I'd like my cactus test use ejb2 to verify the data is actually there.  for
instance. if i submit an order using ejb1.submitOrder( orderSubmit ), I'd
like to make sure that the order and the order items exist after submitting
the order.

I'm most likely not explaining this very well, but what's the easiest/best
way to get a handle to ejb2 from my cactus test classes?  ejb1 has the
JNDI_URL and context factory (needed to get ic from ejb2 container) as part
of its deployment descriptors.  is there some way that i can modify my
cactified war so that its jndi has this stuff?  Can i specify that stuff via
the xml that is used for mergewebxml?

ejb1 has the following in the dd to get its remote bean.  the jndi_url is
placed in from the ant script to allow varried environments.

         <env-entry>
            <env-entry-name>cbc.initial.context.factory</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
 
<env-entry-value>weblogic.jndi.WLInitialContextFactory</env-entry-value>
         </env-entry>
         <env-entry>
            <env-entry-name>cbc.jndi.url</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>@JNDI_URL@</env-entry-value>
         </env-entry>

any insights would be most appreciated!!!

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 10/16/2003
 


RE: Getting reference to ejb in other container

Posted by Vincent Massol <vm...@pivolis.com>.
Hi Mark,

This question (as I understand it) is actually independent of Cactus.
Let me try to rephrase your question: "How do I call an EJB from a
Servlet context?".

- You need to define an "ejb-ref"-like entry in your web.xml (not sure
exactly what is needed for EJBs external to your container - please see
your container's documentation).
- You need to map JNDI names in your container-specific web descriptor
file, unless the mapping is implicit. Please refer to your container's
documentation for that

Once you've done that then you can do a simple lookup (probably setting
up the JNDI URL to your other container, and setting the credentials if
required).

-Vincent

> -----Original Message-----
> From: Mark Lybarger [mailto:Mark.Lybarger@CBC-Companies.com]
> Sent: 24 October 2003 22:14
> To: 'Cactus-User (E-mail)
> Subject: Getting reference to ejb in other container
> 
> Here's my setup.  I have ejb1 that I'm testing with cactus.  ejb1 uses
> ejb2,
> via remote interface, that exists in a separate container.  ejb2, is
> basically a dao, findOrderItemsBy( String ProductCode), etc.  To test
> ejb1,
> I'd like my cactus test use ejb2 to verify the data is actually there.
> for
> instance. if i submit an order using ejb1.submitOrder( orderSubmit ),
I'd
> like to make sure that the order and the order items exist after
> submitting
> the order.
> 
> I'm most likely not explaining this very well, but what's the
easiest/best
> way to get a handle to ejb2 from my cactus test classes?  ejb1 has the
> JNDI_URL and context factory (needed to get ic from ejb2 container) as
> part
> of its deployment descriptors.  is there some way that i can modify my
> cactified war so that its jndi has this stuff?  Can i specify that
stuff
> via
> the xml that is used for mergewebxml?
> 
> ejb1 has the following in the dd to get its remote bean.  the jndi_url
is
> placed in from the ant script to allow varried environments.
> 
>          <env-entry>
>
<env-entry-name>cbc.initial.context.factory</env-entry-name>
>             <env-entry-type>java.lang.String</env-entry-type>
> 
>
<env-entry-value>weblogic.jndi.WLInitialContextFactory</env-entry-value>
>          </env-entry>
>          <env-entry>
>             <env-entry-name>cbc.jndi.url</env-entry-name>
>             <env-entry-type>java.lang.String</env-entry-type>
>             <env-entry-value>@JNDI_URL@</env-entry-value>
>          </env-entry>
> 
> any insights would be most appreciated!!!
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.528 / Virus Database: 324 - Release Date: 10/16/2003
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org