OpenEJB does have a client container, but I fully remember how it works. You need to deploy an app-client as part of your ear. IIRC when it deploys, the container will print the module id for the app- client. Then you run a command like this:

java -Dopenejb.client.moduleId=ID_FROM_CONTAINER -jar openejb- client.jar [args]

or the full version if you need to augment the classpath

java -Dopenejb.client.moduleId=ID_FROM_CONTAINER -cp openejb- client.jar:other-jars org.apache.openejb.client.Main [args]

If I were you, I'd just follow example Manu posted as it is easier then dealing with a JEE app-client.

-dain


On Nov 23, 2008, at 11:31 PM, Manu George wrote:

Hi Paul,
            AFAIK there is no client container in openejb. However
you can get DI to work for clients by using the code in the testcases.
See the class org.apache.openejb.test.TestClient. It has two methods
processFieldInjections and processSetterInjections which scan the
classpath for @EJB annotations and inject the values after lookup from
JNDI. You can add this code to the main class that runs for yout
client and you can get injection to work

Regards
Manu



On Fri, Nov 21, 2008 at 5:58 PM, Manu George <[EMAIL PROTECTED]> wrote:
Hi Paul,

I am not sure about this. If you look into the iTests it seems to have
something similar in the RemoteiTests. I think some of the remote
clients are using @EJB. If anyone knows how to configure this, please
advise.  Meanwhile let me try to figure out how this works

Regards
Manu

On Wed, Nov 19, 2008 at 7:10 PM, Paul Spencer
<[EMAIL PROTECTED]> wrote:
Manu,
Is their a "client container"? Or stated another way; how can OpenEJB be configured to be a container for the client application, but services like bean declaration and authentication services be done by a remote container?

Paul Spencer

Manu George wrote:

Hi Paul,

If it is a standalone client application with its own main method, it
runs outside the container.So you cannot get beans injected and you
will need to always look them up via remote JNDI lookup

Regards
Manu

On Tue, Nov 18, 2008 at 7:14 PM, Paul Spencer
<[EMAIL PROTECTED]> wrote:

I have a EJB3 client application that is not getting the the bean via
annotation. Getting the bean via the initial context works.

***
* Annotation to get the customerBean
***
@EJB (name="CustomerBeanRemote)
private CustomerBean customerBean


1) How do I use annotations, like @EJB, in an EJB3 client?

2) Is their Maven configuration other then a dependency on
openejb-client that is necessary?

Paul Spencer







Reply via email to